Every time I disconnect my three external monitors from my laptop, or when I plug them back in, all the resolution and extended desktop settings are messed up. I'll have to change back the settings to get it right again.
I am using gnome 3.18.5 on Ubuntu 16.04. I have Intel HD graphics 530 and an Nvidia 960M with nvidia driver version 375.39. I also installed the gnome shell extension called 'Fix-Multi-Monitors', which did indeed fix a bunch of issues like windows only moving between two out of three monitors with window moving shortcuts.
Anyway, what I'd like to do is somehow have the settings saved for when I've plugged in all three monitors, so I can simply run one single script or setting, so it instantly loads up how I want it, or maybe even that this happens automatically when three displays are detected. I should add that I always plug in the monitors the same way.
What also bothers me is that I have this wallpaper enabled which spans all three monitors but when they are disconnected the wallpaper becomes a thin line on the laptop monitor with the rest of the screen black. I'd like to see only the middle part of that wallpaper to show in that case or maybe have another wallpaper load up automatically when external monitors are disconnected. I hope someone can help me or direct me in the right way to make this a better experience.
I did find a command line tool called disper of which i've read the man page and tried a bunch of commands but I don't think it's able to do what I want.
The paths to my wallpapers are:
/home/olm/Pictures/Wallpapers/3monitorwallpaper.jpg
/home/olm/Pictures/Wallpapers/1monitorwallpaper.jpg
Best Answer
1. Script to run your command if four screens are connected
The script below is an edited version of this one.
What it does
Once per five seconds, it checks the number of connected screens. If the number changes, and the total number of connected screens is four, it runs the
xrandr
command we found in the comment(s).How to use
four_screens.py
Test run the script from a terminal with the command:
and connect your screens. After the fourth is connected, your screen setup should be made.
If all works fine, add the script to Startup Applications: Dash > Startup Applications > Add. Add the command:
Notes
2. Alternatively, a shortcut
If, for whatever reason, you'd prefer not to run a background script, you can run the same command through a keyboard shortcut:
Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command: