2

I've installed ubuntu on a retina Macbook Pro, and have managed to get the things to look at a reasonable size by scaling the display:

xrandr --output DP-2 --scale 0.9x0.9

When I connect my external monitor, I scale it like so:

xrandr --output DP-4 --scale 1.5x1.5

These work great, except after I unplug my external monitor and plug it back in again, I have to re-run the command to scale it to the size I would like.

How can I have this done automatically? (I would like to avoid just creating a macro to just run that command; I'd like it to run automatically each time I plug in my monitor)

1 Answers1

0

Patterned from the scripts found here you can create your own.

First, create a udev script for the hot-plugging of your monitors. Copy and paste the following in a terminal window:

sudo bash -c 'echo "ACTION==\"change\", SUBSYSTEM==\"drm\", ENV{HOTPLUG}==\"1\", RUN+=\"/usr/local/bin/monitor-hotplug.sh\"" > /etc/udev/rules.d/99-monitor-hotplug.rules'

Then create your script that will be called from the udev:

sudo bash -c 'echo "xrandr --output DP-4 --scale 1.5x1.5" > /usr/local/bin/monitor-hotplug.sh'

Then make the script executable:

sudo chmod +x /usr/local/bin/monitor-hotplug.sh

You might have to reboot your host for this to take effect.

Hope this helps!

Terrance
  • 41,612
  • 7
  • 124
  • 183