Is there a way to save my monitor settings? I have an external monitor at work, but each morning i have to plug it in, rearrange the windows from being side by side to being on top of each other. Can I just save this?
Is there a way to save my monitor settings? I have an external monitor at work, but each morning i have to plug it in, rearrange the windows from being side by side to being on top of each other. Can I just save this?
Long story short (that is: do what Nicolas Bernaerts suggests, but I spare you the details): monitors configuration is actually saved in
~/.config/monitors.xml
, but it's not applied at startup/login.The steps to overcome this are:
Log in with the wrong monitors configuration.
Remove current monitor configuration:
Use the Displays application to arrange the monitors as you wish (I have one side monitor rotated counterclockwise).
Once you press Apply, a new
monitors.xml
is created.Now, download and make executable the script and the launcher that force the monitor configuration based on the newly created config file:
At this point, the monitors' configuration can be fixed by launching the update monitor position application.
If you want this to be automatic, simply add a startup application, with the following entries:
Update Monitors Position
update-monitor-position 5
Force monitors position 5 seconds after login
Configuration for all your monitors - hot-plugged or not - should be stored in
$HOME/.config/monitors.xml
by thexrandr
plugin forgnome-settings-daemon
, which is what actually applies the configuration you make in the Monitors capplet.Since it seems that this isn't working properly for everyone, there's clearly a bug somewhere. Urgh.
First three steps to connect your external monitor the way you want and 4th is to save the settings.
Connect your external monitor and check its supported resolution:
Give the following command (This will disable your laptop monitor):
If you want both laptop and external enabled:
(yyyyXzzzz - your laptop resolution.)
The above configuration will clone your screen. Play with "
--right-of
/--left-of
" option if you want.If you need this settings while login, add the checks in
/etc/X11/Xsession.d/45custom_xrandr-settings
(You might need to create one).At office, I have 3 monitors on my laptop, and 2 at home. Two of office monitors are set vertical, while other monitors are at normal orientation.
A. monitors.xml is in ~/.config.
B. Get shell script, "update-monitor-position".
Change the "MONITOR_XML" definition, "monitors.xml" to "monitors-office.xml".
Save it as "update-monitor-position-office", in executable path (/usr/local/sbin/).
C. Get desktop shortcut, "update-monitor-position.desktop"
"update-monitor-position-office".
update-monitor-position-office.desktop:
Shell script, update-monitor-position-office
I prefer to run this script from a terminal since I open one first after login.
First login with the bad configuration - monitors not placed correctly:
Now set your monitors with system settings to create a new
~/.config/monitors.xml
file with proper settings.Copy Nicolas Bernaerts's fixed script from my repo: https://raw.githubusercontent.com/alextomko/monitors/master/monitors and put it in a path to run from terminal.
Ubuntu 12.04 remembers hot-plugged monitor settings. But they are only applied when you reopen the System configuration > Displays applet. This is the case for me, at least, and this is definitively a bug.
jay's answer almost worked for me, but I needed to do a couple extra steps. I'd make this a comment on his answer but I don't have the reputation.
In the file update-monitor-position-office:
No, there's no way to save configurations on hot-plugged monitors. If you plug in before boot, GNOME should remember the configuration on each boot on a per-device basis (ie, connecting to your monitor at work versus the one at home).
Thank you for pointing me at the
~/.config/monitors.xml
file.I found that there was one created at the time I specified the layout I wanted, and also some kind of back-up,
monitors.xml~
which differed in just the characteristic I wanted to change.If I simply eliminated this backup file, I found that my newly-created one took effect the next time I restarted my machine. No need to download any script.
I guess, if there had been a bug, it has since been fixed.
Also guessing, I'm surmising the backup file got re-instated somehow, but with it gone, the primary file remains the only file in effect.
This worked both on a setup running Ubu 16.04 and one running 19.10
Again, thanks for pointing me at the file.
Note that in Ubuntu 18.04, the monitors.xml layout seems to be different, so some of the xpath queries don't work anymore. I adapted the shell script posted by @jay to work accordingly: