Using KDM with window managers

26 January 2017 in Notes

Using a window manager with KDM as login manager can be a bit tricky. This is how I’ve got dwm and ssh-agent with prompting for passphrases to startup correctly.


Choose the “custom” entry in the session selection which uses .xprofile. If you used a .xinitrc beforehand with startx, you can just create a link to it:

ln -s ~/.xinitrc .xprofile

Your .profile get also loaded, but notice that the environment can differ a bit…


I had

if [ $TERM == "linux" ]; then 
    eval $(ssh-agent -s)

In .profile. This of course didn’t work, as the terminal isn’t a login shell. Removing the conditional in .profile doesn’t work either, you’ll get a new ssh-agent for each terminal you open. So I moved the eval $(ssh-agent -s) to .xprofile. To load the ssh-keys, I’ve also added:

SSH_ASKPASS=/usr/libexec/ssh-askpass ssh-add $HOME/.ssh/id_rsa


The relevant parts of my .xprofile now look like this:

xscreensaver -no-splash &
dwmstatus &

eval $(ssh-agent -s)
SSH_ASKPASS=/usr/libexec/ssh-askpass ssh-add $HOME/.ssh/id_rsa

ck-launch-session dwm 2> /dev/null