xrandr scale monitor output by default
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!
Related videos on Youtube
Comments
-
Marc Bacvanski over 1 year
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)
-
Terrance over 7 yearsMaybe look at github.com/codingtony/udev-monitor-hotplug and see if that might be something you're looking for.
-
Marc Bacvanski over 7 yearsIt seems like it should be such a primitive function of the OS; is there a way to do it without any third-party tools?
-
Terrance over 7 yearsIt's just showing scripts you can use and where to put them. One that the GIT person already did.
-
Terrance over 7 yearsI wrote an answer based on that. Maybe it might work for you.
-
Jacob Vlijm over 7 yearsPossible duplicate of Run script when monitor is connected
-