DWM – start up script that works with GDM login manager

*** 2011-04-18 Updated with my current dwm config files, see the jg_dwm_conf.tar.gz below.

My config: jg_dwm_conf.tar

Goal: Be able to exit DWM and get back to the GDM – gnome login manager.
To be able to hit MODKEY+SHIFT+Q, exit dwm and get me back to the login manager.
Where I can chose another user or window manager. Or if I make a change in dwm and need to re-load it, this would work as well.
Before I had to reboot :)

Finally got this working like I want it to – with some help from #suckless on irc.oftc.net.
This works for me with RHEL6, GDM –version 2.30.4 and DWM 5.8.2.
My problem was that before (you can see how that looked in this post) I ran the dwm also in a loop. But this is not necessary. If you want to keep the statusbar updated with some goodies by running a while loop, you only need to run the xsetroot in a while loop.


Looks like this:

[Desktop Entry] Encoding=UTF-8
Comment=This session starts dwm


Looks like this (updated on 2011-04-18):

#not applicable? I do not have this directory in my home dir.
# --- commands here and before the "while true; do" are run once
#xrdb -merge ~/.Xresources
#open screensaver (so that gnome-screensaver-command -l works)
/usr/bin/gnome-screensaver &
#open pwer manager
#exec gnome-power-manager

#black bg
#want this
#path to background
xsetroot -solid black

#while loop to update statusbar with some goodies
while true; do
battotal=`awk '/last full capacity/{print $4}' < /proc/acpi/battery/BAT0/info`;
batfree=`awk '/remaining capacity/{print $3}' < /proc/acpi/battery/BAT0/state`;
battper=$(( 100*$batfree/$battotal ));
battery=`awk '/charging state/{print $3}' < /proc/acpi/battery/BAT0/state`;
#memfreak to get it in MB
memfreak2=`grep MemFree /proc/meminfo | awk '{ print $2 }'`;
memfreak=$(( $memfreak2/1024 ));
CLK=$( date +'%a %b %d %R:%S %Z' )
VOL=$( amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]' )
AVG=$( cat /proc/loadavg | cut -d ' ' -f -3 )
#network stats in Bytes
#NW=$( dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}' )
#this one is not so good, increases a delay of 1-2s of the updating.
#put it in the xsetrootname plz (tip of the day, do not put | as first char after "
xsetroot -name "$AVG | $memfreak MB | $battper% $battery | Vol: $VOL | $CLK | "
sleep 1
done &

#loop is done? :p


sleep 1
/usr/bin/ck-launch-session &
/usr/local/bin/stalonetray &
/usr/bin/nm-applet &
/usr/bin/gnome-volume-control-applet &
feh -z -Z --bg-scale /home/jguldmyr/Pictures/dwm_pattern.png
#feh -z -Z -B black -b trans --bg-scale /home/jguldmyr/Pictures/Flow.png
#start dwm after loop
exec /usr/local/bin/dwm > /dev/null

3 thoughts on “DWM – start up script that works with GDM login manager

  1. Pingback: Making use of IBM Laptop T40 – Part 4 | Storefi

  2. Marcos Jacoby

    And what steps I have to do to use dwm as wm in GnomeDE instead metacity?
    I’m using Ubuntu Lucid Lynx modified distribution called Comfusion3 that already have Gnome and Openbox preinstalled.
    Can you help me?


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.