Add initial config

This is just some preliminary config in order to make StumpWM usable
and give it a nice look. I’m also mostly just playing around to see
how StumpWM works and behaves.
This commit is contained in:
Lucien Cartier-Tilet 2021-07-25 10:14:00 +02:00
parent ba9d6622df
commit 0b9c9b2a16
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
6 changed files with 217 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.log*

3
commands.lisp Normal file
View File

@ -0,0 +1,3 @@
(defcommand firefox () ()
"Run or raise Firefox."
(run-or-raise "firefox" '(:class "Firefox") t nil))

113
init.lisp Normal file
View File

@ -0,0 +1,113 @@
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp"
(user-homedir-pathname))))
(when (probe-file quicklisp-init)
(load quicklisp-init)))
;;; init
(in-package :stumpwm)
(setf *default-package* :stumpwm)
;; (set-module-dir (concatenate 'string (getenv "HOME") "/.stumpwm.d/modules"))
(set-module-dir "/usr/share/stumpwm/contrib/util/")
(defvar phundrak-nord0 "#2e3440")
(defvar phundrak-nord1 "#3b4252")
(defvar phundrak-nord2 "#434c5e")
(defvar phundrak-nord3 "#4c566a")
(defvar phundrak-nord4 "#d8dee9")
(defvar phundrak-nord5 "#e5e9f0")
(defvar phundrak-nord6 "#eceff4")
(defvar phundrak-nord7 "#8fbcbb")
(defvar phundrak-nord8 "#88c0d0")
(defvar phundrak-nord9 "#81a1c1")
(defvar phundrak-nord10 "#5e81ac")
(defvar phundrak-nord11 "#bf616a")
(defvar phundrak-nord12 "#d08770")
(defvar phundrak-nord13 "#ebcb8b")
(defvar phundrak-nord14 "#a3be8c")
(defvar phundrak-nord15 "#b48ead")
;; startup
(setf *startup-message* nil)
(run-shell-command "autostart")
;;; workspaces
(when *initializing*
(grename "term")
(gnewbg "emacs")
(gnewbg "browser")
(gnewbg "files")
(gnewbg "discord")
(gnewbg "private"))
(load "~/.stumpwm.d/keybindings.lisp")
;;; load ttf
;; (require 'clx-truetype)
;; (ql:quickload :truetype-clx)
;; (load-module "ttf-fonts")
;; (set-font (make-instance 'xft:font
;; :family "DejaVu Sans Mono for Powerline"
;; :subfamily "Regular"
;; :size 7
;; :antialias t))
(set-border-color phundrak-nord4)
(set-focus-color phundrak-nord15)
(set-unfocus-color phundrak-nord4)
(set-float-focus-color phundrak-nord15)
(set-float-unfocus-color phundrak-nord4)
(setf *normal-border-width* 3
*float-window-border* 3
*float-window-title-height* 15
*window-border-style* :thick)
;; configs
(setf *mouse-focus-policy* :click
*float-window-modifier* :META)
;; message and input bar
(setf *input-window-gravity* :top
*message-window-padding* 5
*message-window-y-padding* 5
*message-window-gravity* :top)
;;; gaps
(load-module "swm-gaps")
(setf swm-gaps:*head-gaps-size* 0
swm-gaps:*inner-gaps-size* 5
swm-gaps:*outer-gaps-size* 15)
(when *initializing*
(swm-gaps:toggle-gaps))
;;; end session module
(load-module "end-session")
;;; global windows list module
(load-module "globalwindows")
;;; Modeline
(load "~/.stumpwm.d/modeline.lisp")
(when *initializing*
(mode-line))
(load-module "swm-ssh")
(setq swm-ssh:*swm-ssh-default-term* "kitty")
;;; load window placement rules
(load "~/.stumpwm.d/placement.lisp")
;;; alert module
(load-module "alert-me")
;;; menu for stumpwm
(load-module "app-menu")
(setq app-menu:*app-menu*
'("Emacs" "emacs"))
;;; globalwindow
(load-module "globalwindows")
(setf *startup-message* "StumpWM is ready!")

63
keybindings.lisp Normal file
View File

@ -0,0 +1,63 @@
;;; set prefix
(in-package :stumpwm)
(set-prefix-key (kbd "s-SPC"))
(defvar browser (getenv "BROWSER"))
(defvar editor (getenv "EDITOR"))
(defvar *my-frames-management-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd ".") "iresize")
(define-key m (kbd "h") "hsplit")
(define-key m (kbd "v") "vsplit")
(define-key m (kbd "-") "hsplit")
(define-key m (kbd "/") "vsplit")
(define-key m (kbd "H") "hsplit-equally")
(define-key m (kbd "V") "vsplit-equally")
(define-key m (kbd "d") "remove-split")
(define-key m (kbd "D") "only")
(define-key m (kbd "e") "expose")
(define-key m (kbd "s") "sibling")
(define-key m (kbd "u") "next-urgent")
(define-key m (kbd "c") "move-focus left")
(define-key m (kbd "t") "move-focus down")
(define-key m (kbd "s") "move-focus up")
(define-key m (kbd "r") "move-focus right")
(define-key m (kbd "C") "move-window left")
(define-key m (kbd "T") "move-window down")
(define-key m (kbd "S") "move-window up")
(define-key m (kbd "R") "move-window right")
(define-key m (kbd "C-c") "exchange-direction left")
(define-key m (kbd "C-t") "exchange-direction down")
(define-key m (kbd "C-s") "exchange-direction up")
(define-key m (kbd "C-r") "exchange-direction right")
m))
(defvar *my-applications-keymap*
(let ((m (make-sparse-keymap)))
(define-key m (kbd "b") (concat "exec " browser))
(define-key m (kbd "e") (concat "exec " editor))
(define-key m (kbd "g") "exec gimp")
m))
(define-key *top-map* (kbd "s-RET") "exec kitty")
(define-key *top-map* (kbd "s-a") '*my-applications-keymap*)
(define-key *top-map* (kbd "s-r") "reload")
(define-key *root-map* (kbd "SPC") "exec kitty")
(define-key *root-map* (kbd "b") "exec firefox")
(define-key *root-map* (kbd "e") "exec emacsclient -c")
(define-key *root-map* (kbd "C-e") "exec emacs")
(define-key *root-map* (kbd "g") "exec gimp")
(define-key *root-map* (kbd "l") "exec plock")
(define-key *root-map* (kbd "n") "exec nemo")
(define-key *root-map* (kbd "w") '*my-frames-management-keymap*)
(define-interactive-keymap (iresize tile-group) (:on-enter #'setup-iresize
:on-exit #'resize-unhide
:abort-if #'abort-resize-p)
((kbd "c") "resize-direction left")
((kbd "t") "resize-direction down")
((kbd "s") "resize-direction up")
((kbd "r") "resize-direction right"))

27
modeline.lisp Normal file
View File

@ -0,0 +1,27 @@
(defvar phundrak-nord0 "#2e3440")
(defvar phundrak-nord1 "#3b4252")
(defvar phundrak-nord2 "#434c5e")
(defvar phundrak-nord3 "#4c566a")
(defvar phundrak-nord4 "#d8dee9")
(defvar phundrak-nord5 "#e5e9f0")
(defvar phundrak-nord6 "#eceff4")
(defvar phundrak-nord7 "#8fbcbb")
(defvar phundrak-nord8 "#88c0d0")
(defvar phundrak-nord9 "#81a1c1")
(defvar phundrak-nord10 "#5e81ac")
(defvar phundrak-nord11 "#bf616a")
(defvar phundrak-nord12 "#d08770")
(defvar phundrak-nord13 "#ebcb8b")
(defvar phundrak-nord14 "#a3be8c")
(defvar phundrak-nord15 "#b48ead")
(setf
*mode-line-background-color* phundrak-nord1
*mode-line-foreground-color* phundrak-nord5
*mode-line-border-color* phundrak-nord1
*mode-line-border-width* 0
*mode-line-timeout* 1
*group-format* " %t "
*time-modeline-string* "%H:%M"
*window-format* "<%n:%25t>"
*screen-mode-line-format* (list "%g %v ^> |  %d"))

10
placement.lisp Normal file
View File

@ -0,0 +1,10 @@
(clear-window-placement-rules)
(define-frame-preference "browser"
(nil t t :class "Firefox"))
(define-frame-preference "emacs"
(nil t t :class "Emacs"))
(define-frame-preference "files"
(nil t t :class "nemo"))