Basic Configuration

Init File

As mentioned in the documentationopen in new window, the configuration files can be in different locations, but I chose an Emacs-like configuration: put everything in ~/.stumpwm.d/. We begin by indicating quicklisp how to properly initialize:

#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
                                       (user-homedir-pathname))))
  (when (probe-file quicklisp-init)
    (load quicklisp-init)))

Then, our first StumpWM-related code is declaring we are using the stumpwm package, and this is also our default package. This will allow us to avoid using the prefix stumpwm: each time we are using a function or a variable from this package.

(in-package :stumpwm)
(setf *default-package* :stumpwm)

Since I install StumpWM with my package manager (I use the AUR’s stumpwm-git package), StumpWM’s modules are installed to /usr/share/stupmwm/contrib/utils/, let’s indicate that to StumpWM.

(set-module-dir "/usr/share/stupmwm/contrib/")

A startup message can be used when initializing StumpWM. For now, let’s set it to nil.

(setf *startup-message* nil)

The first thing I want to do after that is to set some decent cursor pointer as well as get a bunch of stuff started. To see what’s in the autostart script, seen here,

(run-shell-command "autostart")

Next I need to register the AltGr key so it works correctly when used. On my system, the value of *altgr-offset* is 4, but on yours it might be 6, so be careful and refer to the manual on that matter.

(setf *altgr-offset* 4)
(register-altgr-as-modifier)

Now, we’ll load a couple of my custom files that will be described below:

File to be loaded
bluetooth.lisp
commands.lisp
placement.lisp
utilities.lisp
keybindings.lisp
theme.lisp
modeline.lisp
systemd.lisp

This is equivalent to the Common Lisp code:

(load "~/.stumpwm.d/bluetooth.lisp")
(load "~/.stumpwm.d/commands.lisp")
(load "~/.stumpwm.d/placement.lisp")
(load "~/.stumpwm.d/utilities.lisp")
(load "~/.stumpwm.d/keybindings.lisp")
(load "~/.stumpwm.d/theme.lisp")
(load "~/.stumpwm.d/modeline.lisp")
(load "~/.stumpwm.d/systemd.lisp")

Once the modeline file is loaded, let’s indicate StumpWM to activate it:

(when *initializing*
  (mode-line))

Another thing I want to set is to use the super key to move floating windows and window focus to transfer from one window to another only on click.

(setf *mouse-focus-policy*    :click
      *float-window-modifier* :SUPER)

Next, some modules will be loaded from the stumpwm-contrib package (which is included in stumpwm-git in the AUR). Here is a short list including a short description of what they are for:

Module NameWhy It Is Loaded
beckonBring the mouse cursor to the current window
end-sessionGracefully end programs when ending user session
globalwindowsNavigate between windows from all workspaces
mpdInteract with MPD
stump-backlightNative management of backlight in StumpWM
urgentwindowsGet urgent windows
(load-module "beckon")
(load-module "end-session")
(load-module "globalwindows")
(load-module "mpd")
(load-module "stump-backlight")
(load-module "urgentwindows")

In order to be able to use MPD from StumpWM itself, we’ll need to connect to it.

(mpd:mpd-connect)

Finally, we can notify the user everything is ready.

(setf *startup-message* "StumpWM is ready!")

And it’s done! We can now move on to the creation of the other CLisp files.