Last active
August 8, 2020 06:15
-
-
Save jmbr/a63e00c70de6567ae2159ce28f2ae5d5 to your computer and use it in GitHub Desktop.
My StumpWM configuration file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; StumpWM initialization file. | |
(ql:quickload "swank") | |
(in-package :stumpwm) | |
(setf *window-border-style* :none | |
*resize-hides-windows* nil) | |
;;; Redirect output to ~/.stumpwm.d/stumpwm.log | |
(let ((stumpwm-log-file (data-dir-file "stumpwm" "log"))) | |
(ignore-errors | |
(delete-file stumpwm-log-file)) | |
(redirect-all-output stumpwm-log-file)) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Custom commands | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(defcommand zotero () () | |
"Run Zotero." | |
(run-or-raise "/home/jmbr/Zotero/zotero" '(:class "Zotero"))) | |
;;; Use the command list-window-properties to find out the class | |
;;; (WM_CLASS) of each window and then use it in run-or-raise. | |
(defcommand gnome-terminal () () | |
"Run Gnome Terminal." | |
(run-or-raise "/usr/bin/gnome-terminal" '(:class "Gnome-terminal"))) | |
(defcommand emacs () () | |
"Run GNU Emacs." | |
(let ((cmd "bash -i -c \"emacsclient --create-frame --alternate-editor=emacs\"")) | |
(run-or-raise cmd '(:class "Emacs")))) | |
(defcommand google-chrome () () | |
"Run Google Chrome." | |
(run-or-raise "/usr/bin/google-chrome" '(:class "google-chrome"))) | |
(defcommand firefox () () | |
"Run Mozilla Firefox." | |
(run-or-raise "/usr/bin/firefox" '(:class "Firefox"))) | |
(defcommand create-swank-server () () | |
"Create swank server." | |
(swank:create-server :dont-close t)) | |
(defvar *xrandr-default-screen* t) | |
(defcommand toggle-default-screen () () | |
"Toggle default screen on or off." | |
;; TODO: Handle exceptions gracefully. | |
(let* ((default-screen (not *xrandr-default-screen*)) | |
(cmd (concatenate 'string | |
"/usr/bin/xrandr --output DP-0 " | |
(if default-screen "--auto" "--off")))) | |
(run-shell-command cmd) | |
(setf *xrandr-default-screen* default-screen))) | |
(define-key *root-map* (kbd "z") "zotero") | |
(define-key *root-map* (kbd "c") "gnome-terminal") | |
(define-key *root-map* (kbd "C-c") "gnome-terminal") | |
(define-key *root-map* (kbd "e") "emacs") | |
(define-key *root-map* (kbd "w") "firefox") | |
(define-key *root-map* (kbd "W") "google-chrome") | |
(define-key *root-map* (kbd "m") "mode-line") | |
(define-key *root-map* (kbd "C-s") "create-swank-server") | |
(define-key *root-map* (kbd "n") "next") | |
(define-key *root-map* (kbd "p") "prev") | |
(define-key *root-map* (kbd ".") "toggle-default-screen") | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Window and group preferences. | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(pushnew '(:class "google-chrome") *deny-raise-request* :test #'equal) | |
(pushnew '(:class "Firefox") *deny-raise-request* :test #'equal) | |
(pushnew '(:class "gnuplot_qt") *deny-raise-request* :test #'equal) | |
(clear-window-placement-rules) | |
(define-frame-preference "Default" | |
;; frame raise lock (lock AND raise == jumpto) | |
(0 t nil :class "Gnome-terminal") | |
(1 t nil :class "Emacs")) | |
(gnewbg "Web") | |
(gnewbg "Misc") | |
(gnewbg "Misc2") | |
(gnewbg-float "Float") | |
(define-frame-preference "Web" | |
;; frame raise lock (lock AND raise == jumpto) | |
(0 t nil :class "Firefox") | |
(1 t nil :class "Thunderbird")) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;;; Modules | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(set-module-dir #P"/home/jmbr/.stumpwm.d/modules") | |
;; ;;; Run xlsfonts to see the list of all available fonts. | |
;; (set-font "-misc-fixed-bold-r-normal--0-0-100-100-c-0-iso8859-1") | |
(ql:quickload "ttf-fonts") | |
;; (xft:cache-fonts) | |
(set-font (make-instance 'xft:font | |
:family "DejaVu Sans Mono" | |
:subfamily "Bold" :size 14)) | |
(ql:quickload "end-session") | |
(add-hook *quit-hook* (lambda () | |
(run-shell-command "/usr/bin/gnome-session-quit --force --no-prompt"))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment