I'm running Arch Linux 64-bit on a Samsung RV511. I often connect external monitors using
xrandr. As I run LXDE with Awesome as a window manager, I need to prepare the xrandr-command by killing certain GUI elements and restarting them afterwards to have them correctly positioned.
Here is my script:
#!/bin/sh # kill conky and lxpanel killall lxpanel killall conky # set monitor xrandr --output LVDS1 --mode 1366x768 --pos 1680x282 --output VGA1 --mode 1680x1050 --pos 0x0 # restart awesome killall -HUP awesome # restart lxpanel and conky lxpanel -p LXDE & conky &
Now I'm running into a strange problem. When I run all of the above commands in the same sequence from the command line, I get a neat monitor configuration. However, when I run the script, the GUI crashes, leaving a strange pattern of wallpaper and panel elements. I get the same problem if I launch the
xrandr command without having killed the
lxpanel first, which is why i assume the
xrandr command somehow does not "wait" for the kill commands?
Or is there a different reason?
sleep 3 between the code blocks solved the problem, although I still have no idea what the basic problem is. Anyway, here is my current script for future reference:
#!/bin/bash # kill conky and lxpanel killall lxpanel killall conky sleep 4 # set monitor xrandr --output LVDS1 --mode 1366x768 --pos 1680x282 --output VGA1 --mode 1680x1050 --pos 0x0 sleep 4 # restart awesome killall -HUP awesome # restart lxpanel and conky sleep 4 lxpanel -p LXDE & conky &
Post-Edit: The problem cannot be considered completely solved after all. Sometimes I have to
kill xinit after startup and
startx again for it to work. There seems to be some uptime-related problem. Needless to say I have no idea what.