Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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).

share|improve this question

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
Thanks for the tipp, i am going to try that as soon as i can. But killing gnome-settings does sound like it would bring a number other problems with it. I'll report when i tried it –  YumTum Apr 11 '13 at 17:34
    
You should only lose theming and such for a few moments while gnome-session restarts it. I hope, but cannot confirm that it will also reset your monitor setup when it comes back. –  Michael Terry Apr 11 '13 at 18:14
    
I tried it, and it partially worked, but funnily gnome-settings-daemon was not running on startup (but it loaded monitors.xml anyway on startup). After that I could not reload it with killall or kill because it neither found the name nor did the PID show up in top. –  YumTum Apr 12 '13 at 10:17
    
I found a better solution for my problem for which I will post an answer, but as your question actually answers the given question I will mark it as solved. –  YumTum Apr 12 '13 at 10:23

I found a very simple way to solve the problem:

It is possible to give xrandr the configurations for the monitor as additional options. In my case it were the following:

xrandr --output LVDS1 --auto --mode 1366x768 --pos 0x0 --rotate normal --primary
xrandr --output VGA1 --auto --mode 1680x1050 --pos 1366x0 --rotate normal

with LVDS1 being the laptops monitor and VGA1 the external monitor. (can be inqueried with xrandr -q).

This way it is not necessary to reload monitors.xml or restart lightdm and one can even specify different configurations in one scirpt.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.