dwm restart

January 8, 2010

dwm is a wonderful window manager for X: it’s small, fast and stable.

the only thing I missed, until today, was the possibility to restart it without losing my X session (i.e. all the open windows, etc.). restarting dwm is something you might need to do often, as it does not have config files: changes are done by recompiling the sources.

the trick is to execute dwm in background and sleep forever!

take a look at the last two lines of my .xinitrc:

dwm &

where sleeper looks like this:

while `/bin/true`; do
sleep 1000

now, if you kill dwm (usually with ALT-SHIFT-q) the windows (and X) will still be alive and you can type dwm& in any xterm to get dwm up and running again.

if you really want to quit X, you need to kill the sleeper.

4 Responses to “dwm restart”

  1. Stonebot Says:

    When I try this i go to load dwm and it loads for 1 second then back to the login manager…

  2. Neotericpiguy Says:

    while true; do dwm 2> ~/.dwm.log ; done

    When you kill dwm it will restart right back up.

    Useful if you update config.h and sudo make install a new binary.

  3. meillo Says:

    Instead of `/bin/true` use : . That puts less load onto the machine, is easier to type, and if you know the idiom it’s easier to read too.

    while :; do

  4. Mark Says:

    Thanks, didn’t know about the :

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: