Ubuntu – reload monitors.xml without restarting LightDM

bashlightdmmultiple-monitors

I was writing myself a short script to turn off my laptops monitor in order to only use the bigger external monitor, as I don't always want to use Unity GUI. But after turning the laptop monitor back on with the same script the configurations were all wrong, so I was wondering if there is a way to reload monitors.xml (from the ./config) where all the configurations are stored without restarting whole lightdm? I did this in the current script, and not only killed it all my programs but also did I get an error regarding my keyboard input.

About the setting: My left, smaller monitor is my primary and the right one the secondary. But if monitor.xml is not reloaded both are primary monitors.

Is it probably necessary to restart lightdm? If so, how can I do that in a as secure as possible way without killing all processes (if possible of course).

Best Answer

I don't know the exact mechanism to reload monitors.xml, but I do know that file is a GNOME thing. So maybe killing and restarting gnome-settings-daemon would do the trick.