/my-stumpwm-config

My personal StumpWM config

Primary LanguageCommon Lisp

My StumpWM Config

Summary

This is my StumpWM personal config. Do what you want with it. Summary of its contents follows.

Files

preload/local

after-load-conf

This allows me to write system specific hooks to customize StumpWM inside of local.lisp.

(in-package :hfj)

(after-load-conf ("clean.lisp")
  (message "clean.lisp has been processed!"))

clean

Removes the various hooks I use so I don’t have left-over hooks that are called after I’ve done a “loadrc”.

defaults

Add an after-load-conf hook to override these.

group-names

List of group names to be created.

frame-preferences

List of preferences to pass to define-frame-preference.

debug

my-debug

Simple logging to a specific file.

(my-debug "Window:" window "Frame:" frame)

menu

Menu on super-o. Has wrappers for defcommand to add commands to the menu when they are defined.

For example, I can add a “Browser” under “Apps” in the default menu.

(defapp run-firefox () () ("Browser")
  "Run Firefox"
  (run-or-raise "firefox-bin" '(:class "Firefox")))

I can add a program that disables the touchpad under “Utility” in the default menu.

(defutil toggle-touchpad () () ("Toggle touchpad")
  "Enable/Disable touchpad"
  (run-shell-command "toggle-touchpad"))

Or to any menu I’ve defined with any level of sub-menus.

(def-menu-command pick-me-command () () (*default-menu* "Top" "Middle" "Pick Me!")
  "Example!"
  (message "Picked!"))

Even comes with a StumpWM menu for reloading, restarting, and starting/stopping swank.

emacs

Commands to start and stop swank.

window

with-new-window

Macro to start a process and capture its window and modify it.

Sample from scratchpad.lisp:

(hfj:with-new-window (window cmd)
             :new
             (push (cons name window) *scratch-floats*)
             :focus
             (stumpwm::float-window window (current-group))
             (cond (initial-gravity
                    (resize-by-gravity window initial-gravity ratio))))

Example to float an xterm:

(with-new-window (window "xterm")
  (stumpwm::float-window window (current-group))
  (stumpwm::float-window-move-resize window
                                     :x 50 :y 70
                                     :width 540 :height 400))

scratchpad

Create a “scratchpad” that can be toggled with a single keypress. Two variants exist, to present the window tiled or floating. I haven’t finished tweaking these yet, so don’t expect them to work perfectly yet.

toggle-split-scratchpad

Show a window in a frame above, below, left or right of the current frame. Splits with *default-split-ratio* by default. Uses gravity to determine the split. Corner gravity will pick the shorter of the two sides to place the split.

Example:

(defcommand scratchpad-test () ()
  (scratchpad::toggle-split-scratchpad "my-xterm" "xterm"
                                       :gravity :top-right
                                       :ratio 1/3))

toggle-floating-scratchpad

Floats a window on the current screen based on gravity. Splits with *default-float-ratio* by default. Also has a command scratchpad-float.

Examples:

(defcommand scratchpad-test () ()
  (scratchpad::toggle-split-scratchpad "my-xterm" "xterm"
                                       :gravity :center
                                       :ratio 1/3))
(define-key *top-map* (kbd "s-TAB") "scratchpad-float yakyak-scratch yakyak left")

applications

Various applications. Uses defapp and defutil to place commands directly into the menu.

Also has functions to start named instances of tmux and emacs. This way I can type s-a e e and get an instance of emacs named “e” and I can raise it quickly with the same keypresses. Or s-a e r for one named “r”. Makes it easy to switch back to or between instances of emacs.

groups

Set up groups and preferences defined in defaults.lisp.

session

A menu on s-q for logging out and shutting down. I should probably move this over to the main menu.

binds

Bindings. Uses some convenience functions to simplify maintenance.

(alist-define-keys *top-map*
                   '(("s-h" . "move-focus left")
                     ("s-j" . "move-focus down")
                     ("s-k" . "move-focus up")
                     ("s-l" . "move-focus right")))

;; Create and initialize a set of bindings off "s-f".
(alist-define-keys (create-map *frame-map* "s-f")
                   '(("f" . "frame-windowlist")
                     ("s-f" . "fother")
                     ("n" . "next-in-frame")
                     ("p" . "prev-in-frame")
                     ("e" . "fclear")
                     ("m" . "only")
                     ("=" . "balance-frames")))

;; Or one off "s-w m"
(alist-define-keys (create-map *window-move-map* "m" :on *window-map*)
                   '(("h" . "move-window left")  ;; That is, "s-w m h"
                     ("j" . "move-window down")
                     ("k" . "move-window up")
                     ("l" . "move-window right")))

mouse

Set focus to follow the mouse, and the mouse to follow focus.

border

For styles which I haven’t really gotten around to messing with yet.

mode-line

Basic mode line config.