I'm running Ubuntu on a MacBook and use an external monitor. So I use xrandr to turn off the laptop monitor on startup if the external monitor is connected with this small ruby script:
#!/usr/bin/ruby display = `xrandr -q | grep DP-1`.to_s if !display.include? "disconnected" then `xrandr --output LVDS-1 --off` `xrandr --output DP-1 --mode 1920x1080` sleep 3 end
I use the rc.lua to star the script and a few other programms in awesome:
... awful.util.spawn_with_shell("/home/jo/.config/awesome/setdisplay.rb") awful.util.spawn_with_shell("nm-applet") awful.util.spawn_with_shell("dropbox start") awful.util.spawn_with_shell("setxkbmap de") awful.util.spawn_with_shell("thunderbird") awful.util.spawn_with_shell("google-chrome") awful.util.spawn_with_shell("pidgin") ...
The monitor script works nicely but unfortunately a few of the programms are started twice such as
nm-applet. I think that all of the programms are started twice but that the other programms such as
thunderbird and so only allow one instance. I think so because
thunderbird complains about another running instance.
Is it possible that there are two instances of awesome each starting the progamms and then when the laptop monitor is deactiveted the programms are moved to the external monitor's awesome instance? Any ideas how to avoid that?