[buug] selecting window managers from xdm: the solution
Ian Zimmerman
itz at speakeasy.org
Thu Nov 15 23:18:21 PST 2001
I asked: how can one select a window manager du jour when logging in
through xdm? (and not wdm or gdm or kdm)
The easy answer: modify /usr/X11R6/lib/X11/xdm/Xresources (which on my
Debian system is really /etc/X11/xdm/Xresources) like this
*** Xresources~ Thu Nov 15 22:55:05 2001
--- Xresources Thu Nov 15 22:54:40 2001
***************
*** 10,15 ****
--- 10,17 ----
xlogin*login.translations: #override \
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
+ <Key>F2: set-session-argument(wmaker) finish-field()\n\
+ <Key>F3: set-session-argument(sawfish) finish-field()\n\
<Key>Delete: delete-character()\n\
<Key>Left: move-backward-character()\n\
<Key>Right: move-forward-character()\n\
Then, when you hit F2 or F3 in the xdm greeter, you'll be dropped in a
WindowMaker or sawfish session respectively.
Unfortunately, this didn't quite satisfy me, as your ~/.xsession
script is completely ignored this way; the system will just start the
window manager directly, bypassing the ~/.xsession script. I have
some setup code there that I depend on:
#! /bin/bash
case $DISPLAY in
:0)
if [ -f $HOME/.Xmodmap ]; then
/usr/bin/X11/xmodmap $HOME/.Xmodmap
fi ;;
esac
. /etc/profile
. $HOME/.bashrc
exec wmaker
So, the requirement was to pass the session argument from the greeter
down to ~/.xsession. Like so often in Unix, the solution is at once
baroque and elegant:
Add an executable script linked to both /usr/local/bin/xsession-wmaker
and /usr/local/bin/xsession-sawfish, containing
#! /bin/sh
# a hack to enable flexible window manager flipping in xdm
oldpath=$PATH
PATH=/bin:/usr/bin
style=`basename $0 | sed -e 's/^xsession-//'`
echo $style > $HOME/.xsession_style
PATH=$oldpath
exec $HOME/.xsession
Modify Xresources as follows:
*** Xresources~ Thu Nov 15 22:55:05 2001
--- Xresources Thu Nov 15 22:54:40 2001
***************
*** 10,17 ****
xlogin*login.translations: #override \
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
! <Key>F2: set-session-argument(wmaker) finish-field()\n\
! <Key>F3: set-session-argument(sawfish) finish-field()\n\
<Key>Delete: delete-character()\n\
<Key>Left: move-backward-character()\n\
<Key>Right: move-forward-character()\n\
--- 10,17 ----
xlogin*login.translations: #override \
Ctrl<Key>R: abort-display()\n\
<Key>F1: set-session-argument(failsafe) finish-field()\n\
! <Key>F2: set-session-argument(xsession-wmaker) finish-field()\n\
! <Key>F3: set-session-argument(xsession-sawfish) finish-field()\n\
<Key>Delete: delete-character()\n\
<Key>Left: move-backward-character()\n\
<Key>Right: move-forward-character()\n\
And modify ~/.xsession as follows:
*** .xsession~ Thu Nov 15 23:09:48 2001
--- .xsession Thu Nov 15 23:09:27 2001
***************
*** 10,13 ****
. /etc/profile
. $HOME/.bashrc
! exec wmaker
--- 10,17 ----
. /etc/profile
. $HOME/.bashrc
! if [ ! -f $HOME/.xsession_style ]; then
! echo wmaker > $HOME/.xsession_style
! fi
!
! exec `cat $HOME/.xsession_style`
Voila. It even remembers your last choice, using it as a default
until you hit the other function key :)
BTW, if it wasn't clear (I guess it wasn't :), I am looking for a job,
too. (Sysadmin/webmaster/programer).
--
Ian Zimmerman, Oakland, California, U.S.A.
Hypocrisy, arrogance and manipulation: sure-fire ways to earn hatred.
GPG pub key: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087
More information about the buug
mailing list