Using a custom startup script for xmonad

This article was published 6 years ago. Due to the rapidly evolving world of technology, some concepts may no longer be applicable.

As lightdm doesn’t call .xinitrc, I needed to find another way to start things like trayer. The easiest way is to create a file called .start-xmonad in your home directory, and point the lightdm launcher to it.

Here’s what my file looks like:

trayer --edge bottom --width 20 --height 22 --transparent true --tint 0x3c3b37 --alpha 0 &
dropbox start &
nm-applet &
xsetroot -cursor_name left_ptr  
setxkbmap -layout uk
dconf write /org/gnome/settings-daemon/plugins/xrandr/active false
feh --bg-fill ~/Documents/current-wallpaper.png

To make the launcher use this, I needed to edit /usr/share/xsessions/xmonad.desktop. It looks like this:

[Desktop Entry]
Comment=Lightweight tiling window manager

Now, when I launch xmonad my custom setup stuff is run too

Thoughts on this post

zhefa 2014-10-13

I thought you ditched xmonad and used i3 instead? Are you going back to xmonad?

michael 2014-10-13

I did, then after a few months I switched back. I became more comfortable with tiling WM’s and was missing xmonad’s layout support

Gauthier 2017-08-14

Rather than modifying system files, you could achieve the same with only user files.
/usr/share/xsessions/xmonad.desktop calls to /usr/bin/xmonad-session, which in turn sources .xmonad/xmonad-session-rc.
Create this last file in your $HOME and you’re good to go, even if you don’t have superuser permissions.

Leave a comment?

Leave a Reply to Gauthier Cancel reply