config.phundrak.com/docs/stumpwm/init.org
Lucien Cartier-Tilet 87b3deeed3
All checks were successful
deploy / build (push) Successful in 2m27s
feat: restore sidebar's table of contents for nested pages
2024-01-28 09:06:40 +01:00

5.0 KiB
Raw Blame History

Basic Configuration

Basic Configuration

Init File

As mentioned in the documentation, 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 AURs stumpwm-git package), StumpWMs modules are installed to /usr/share/stupmwm/contrib/utils/, lets indicate that to StumpWM.

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

A startup message can be used when initializing StumpWM. For now, lets 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 whats 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, well load a couple of my custom files that will be described below:

File to be loaded
bluetooth.lisp
commands.lisp
placement.lisp
keybindings.lisp
theme.lisp
utilities.lisp
modeline.lisp
systemd.lisp
(mapconcat (lambda (file)
             (format "(load \"~/.stumpwm.d/%s\")" (car file)))
           files
           "\n")

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/keybindings.lisp")
(load "~/.stumpwm.d/theme.lisp")
(load "~/.stumpwm.d/utilities.lisp")
(load "~/.stumpwm.d/modeline.lisp")
(load "~/.stumpwm.d/systemd.lisp")

Once the modeline file is loaded, lets 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 Name Why It Is Loaded
beckon Bring the mouse cursor to the current window
end-session Gracefully end programs when ending user session
globalwindows Navigate between windows from all workspaces
mpd Interact with MPD
stump-backlight Native management of backlight in StumpWM
urgentwindows Get urgent windows
(mapconcat (lambda (module)
             (format "(load-module \"%s\")" (car module)))
           modules
           "\n")
(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, well need to connect to it.

(mpd:mpd-connect)

Finally, we can notify the user everything is ready.

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

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