Tag Archives: gnome

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.

/usr/share/xsessions/dwm.desktop

Looks like this:

[Desktop Entry] Encoding=UTF-8
Name=dwm
Comment=This session starts dwm
Exec=/usr/local/bin/dwm-start
Type=Application

/usr/local/bin/dwm-start

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


#!/bin/sh
#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
#/usr/share/backgrounds/abstract/Flow.png
xsetroot -solid black

#while loop to update statusbar with some goodies
while true; do
#battery
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 ));
#time
CLK=$( date +'%a %b %d %R:%S %Z' )
#volume
VOL=$( amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]' )
#loadavg
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

 

#traying
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

DWM – not your average mainstream window manager

Have been playing around with a new window manager (new as in for me, I’ve only used fluxbox, kde and gnome before) called DWM – see more information on www.suckless.org.

I’m running it on a T400 with RHEL6 (which uses gnome login manager – gde).

Basically:

  1. if you want to make a change like modify keyboard shortcuts, rules, tagging, top bar stuff, you need to edit config.h and then compile (make and then make install). Then you need to re-load dwm.
  2. after that is done, create a properly formatted file under /usr/share/xsession/
  3. then in the login manager you can chose dwm :)

Notes:

  1. install dmenu as well, it is neat. ALT+P, then type what you want to run, then hit enter. Also if you type in ‘lock’ it will find xlock etc.
  2. ALT+SHIFT+ENTER gives you the terminal, ALT+SHIFT+Q quits dwm and gets you back to the login manager.
  3. ALT is the default, can be modified to apple- or windows-key

My problems :

  1. re-load dwm can be done in several ways but I have not found one that works well for me. If you do like me and run dwm in a while loop the only way I’ve found out so far is to reboot the whole machine. Because I don’t know how to log off the session and get back to the gdm login manager. I hope I do find a way around because rebooting kind of sucks ;)
  2. gnome-session-save –logout does not work -gave some kind of error
  3. MODKEY+SHIFT+Q only seems to re-fresh the screen, doesn’t actually re-load the whole she-bang.

DWM top bar can be edited to show other things than DWM version. See my post here about that.