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'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 google-chrome and nm-applet. I think that all of the programms are started twice but that the other programms such as dropbox, 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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

In the awesome Wiki there is a page about autostarting application. There is also an example code to force applications to run only once, see http://awesome.naquadah.org/wiki/Autostart

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.