Files
opalfiles/archive/StumpWM.org
opalvaults 89f5dc9291 -
2021-12-29 17:51:41 -08:00

5.2 KiB

StumpWM Configuration

In my quest to make my computer a Lisp machine in its own right, I am using StumpWM as my window manager.

Init

;;; -*-  mode: lisp; -*-
(in-package :stumpwm)
;; (defvar *sbcl-path* "~/.guix-home/profile/share/common-lisp/sbcl/")

;; StumpWM Modules
(stumpwm:add-to-load-path "~/.guix-home/profile/share/common-lisp/sbcl/stumpwm-swm-gaps")
(stumpwm:add-to-load-path "~/.guix-home/profile/share/common-lisp/sbcl/stumpwm-ttf-fonts")
(stumpwm:add-to-load-path "~/.guix-home/profile/share/common-lisp/sbcl/stumpwm-stumptray")
(stumpwm:add-to-load-path "~/.guix-home/profile/share/common-lisp/sbcl/stumpwm-kbd-layouts")

Environment

Workspaces

(run-commands
 "gnewbg I"
 "gnew II"
 "gnewbg III"
 "gnewbg IV"
 "gnewbg V"
 "gnewbg-float F")

Set Prefix

(set-prefix-key (kbd "s-ESC"))

Focus window with mouse

(setf *mouse-focus-policy* :click)

Messages

(setf *message-window-gravity* :center
      *input-window-gravity* :center
      *window-border-style* :thin
      *message-window-padding* 3
      *maxsize-border-width* 2
      *normal-border-width* 2
      *transient-border-width* 2
      stumpwm::*float-window-border* 1
      stumpwm::*float-window-title-height* 1)

Command Window

(setq *input-window-gravity* :center)

Keyboard

Load Keyboard Layout Module

(load-module "kbd-layouts")

Remap Caps Lock

(setf kbd-layouts:*caps-lock-behavior* :esc)

Xmodmap

(run-shell-command "xmodmap ~/Dotfiles/.config/Xmodmap")

Keybinds

;; Set some super key bindings
(define-key *top-map* (kbd "s-h") "move-focus left")
(define-key *top-map* (kbd "s-l") "move-focus right")
(define-key *top-map* (kbd "s-j") "move-focus down")
(define-key *top-map* (kbd "s-k") "move-focus up")

(define-key *top-map* (kbd "s-H") "move-window left")
(define-key *top-map* (kbd "s-L") "move-window right")
(define-key *top-map* (kbd "s-J") "move-window down")
(define-key *top-map* (kbd "s-K") "move-window up")

(define-key *top-map* (kbd "s-f") "fullscreen")
(define-key *top-map* (kbd "s-r") "iresize")
(define-key *top-map* (kbd "s-Q") "delete")
(define-key *top-map* (kbd "s-SPC") "run-shell-command emacsclient -e \"(call-interactively #'app-launcher-run-app)\"")
(define-key *top-map* (kbd "s-L") "run-shell-command slock")
(define-key *top-map* (kbd "s-E") "run-shell-command emacs")
(define-key *top-map* (kbd "s-W") "run-shell-command firefox")

(define-key *top-map* (kbd "s-TAB") "next-in-frame")
(define-key *top-map* (kbd "s-S-TAB") "prev-in-frame")

(define-key *top-map* (kbd "s-1") "gselect I")
(define-key *top-map* (kbd "s-2") "gselect II")
(define-key *top-map* (kbd "s-3") "gselect III")
(define-key *top-map* (kbd "s-4") "gselect IV")
(define-key *top-map* (kbd "s-5") "gselect V")

(define-key *top-map* (kbd "s-!") "gmove I")
(define-key *top-map* (kbd "s-@") "gmove II")
(define-key *top-map* (kbd "s-#") "gmove III")
(define-key *top-map* (kbd "s-$") "gmove IV")
(define-key *top-map* (kbd "s-%") "gmove V")

;; Brightness and volume
(define-key *top-map* (kbd "XF86MonBrightnessDown") "run-shell-command brightnessctl set 5%-")
(define-key *top-map* (kbd "XF86MonBrightnessUp") "run-shell-command brightnessctl set +5%")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "run-shell-command amixer set Master 3%- unmute")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "run-shell-command amixer set Master 3%+ unmute")
(define-key *top-map* (kbd "XF86AudioMute") "run-shell-command amixer set Master toggle")

UI

Colors

;; Set UI colors
(setf *colors*
      '("#000000"   ;black
        "#BF6262"   ;red
        "#a1bf78"   ;green
        "#dbb774"   ;yellow
        "#7D8FA3"   ;blue
        "#ff99ff"   ;magenta
        "#53cdbd"   ;cyan
        "#b7bec9")) ;white

(setf *default-bg-color* "#e699cc")

(update-color-map (current-screen))

(setf *window-format* "%m%s%50t")

Gaps

(load-module "swm-gaps")
(setf swm-gaps:*inner-gaps-size* 3)
(run-commands "toggle-gaps-on")

Fonts

Enable TTF fonts
(load-module "ttf-fonts")
(setf xft:*font-dirs* '("/home/opal/.guix-home/profile/share/fonts/"))
(xft:cache-fonts)
(set-font (make-instance 'xft:font :family "Fira Mono" :subfamily "Regular" :size 16))

Mode-Line

(setf *mode-line-background-color* (car *colors*)
      *mode-line-foreground-color* (car (last *colors*))
      *mode-line-timeout* 1)

System tray

;; Add the system tray module
(load-module "stumptray")

(stumptray:stumptray)

Applications

(run-shell-command "emacs")

Repl Start

(require :slynk)
(slynk:create-server :dont-close t)