commit 498ca514a7a17a6d6f854226e1b21f502c9ed4de Spenser Truex <web@spensertruex.com> 2019-11-27 13:27:08 -0800 An init config that works out of the box.
README.org | 39 +++++++++++++++++++++++++++++++++++++++ commands.lisp | 28 ++++++++++++++++++++++++++++ config.lisp | 22 ++++++++++++++++++++++ finalize.lisp | 11 +++++++++++ init.lisp | 7 +++++++ keybindings.lisp | 43 +++++++++++++++++++++++++++++++++++++++++++ package.lisp | 31 +++++++++++++++++++++++++++++++ stumpwm-init.asd | 32 ++++++++++++++++++++++++++++++++ util.lisp | 9 +++++++++ 9 files changed, 222 insertions(+)
diff --git a/README.org b/README.org new file mode 100644 index 0000000..05c12da --- /dev/null +++ b/README.org @@ -0,0 +1,39 @@ +#+title: stumpwm-init +#+author: Spenser Truex +#+email: web@spensertruex.com + +Custom stumpwm init. Should work out of the box without any configuration other +than adding +#+begin_src lisp +(stumpwm:load-module :stumpwm-init) +#+end_src +to your ~.stumpwmrc~ (although there is some [[*Optional Configuration][optional configuration]]!). + +* Features + - Key remappings for Okular (pdf viewer) if it is installed. The bindings are + a Spacemacs-like Emacs/vim mix (which you may not like). + - Include a few lightweight contrib modules. + - ~poison~ command to banish and turn off mouse (q) + - Call xterm with the =Hack= font. + - Use a package to keep the namespace clean, export symbols for [[*Optional Configuration][optional + configuration]]. +* Optional Configuration +** xterm +Install the =Hack= font, or add your own to =stumpwm-init:*xterm-font*=. +** poison +Find your mouse's name with ~xinput --list~, and set it to ~*my-mouse*~. +** app-menu +Any programs in ~stumpwm-init:*app-menu*~ need to be installed to work: +- xterm +- nmtui +- openoffice +- gimp +- pass +- okular +- pavucontrol +- emacs +You may also edit ~stumpwm-init:*app-menu*~ yourself. +* Keybindings + Most can be found under the prefix (bound to =C-i=), but =M-`= (no prefix) is the app-menu. +* Contributing +Pull request onto the develop branch (not master). diff --git a/commands.lisp b/commands.lisp new file mode 100644 index 0000000..dcdf9aa --- /dev/null +++ b/commands.lisp @@ -0,0 +1,28 @@ +(in-package #:stumpwm-init) +(defvar *xterm-font* "Hack" + "The name of the font to use for xterm.") +(defvar *xterm-font-pt* 12 + "The font size to call xterm with.") +(defcommand xterm (&optional additional-argstr) () + "Call xterm with a couple of settings arguments." + (run-shell-command + (concatenate 'string + "xterm -fa '" *xterm-font* "'" + " " "-fs " (format nil "~D" *xterm-font-pt*) + " " additional-argstr))) +(deftermcom nmtui "-e nmtui" xterm) + +(defvar *toggle* nil) +(defvar *my-mouse* "ETPS/2 Elantech Touchpad") +(defcommand poison () () + "Turn the rat all the way OFF (or back on): . +(useful if the touchpad is sensitive while typing)." + (banish) + (run-shell-command + (concatenate 'string + "xinput --" + (if *toggle* + "disable" + "enable") + " '" *my-mouse* "'")) + (setf *toggle* (not *toggle*))) diff --git a/config.lisp b/config.lisp new file mode 100644 index 0000000..a059ddf --- /dev/null +++ b/config.lisp @@ -0,0 +1,22 @@ +(in-package #:stumpwm-init) + +(setq app-menu::*app-menu* + '(("emacs" "emacs") + ("gimp" "gimp") + ("office" "openoffice") + ("pass" + ("copy" pass:pass-copy-menu) + ("generate" pass:pass-generate)) + ("PDF" "okular") + ("sound" "pavucontrol") + ("web" browse:browse) + ("wifi" nmtui))) + +(setf *mode-line-timeout* 1) +(setf *mode-line-foreground-color* "#98BDFB") +(setf *mode-line-border-color* "#028090") +(setf *mode-line-background-color* "#191919") +(setf *mode-line-foreground-color* "#98BDFB") +(setf *screen-mode-line-format* + (list "[^B%n^b] %W^>" "%B | %d")) +(setf *window-format* "%m%n%s%c") diff --git a/finalize.lisp b/finalize.lisp new file mode 100644 index 0000000..138a094 --- /dev/null +++ b/finalize.lisp @@ -0,0 +1,11 @@ +(in-package #:stumpwm-init) + +(run-shell-command "xsetroot -cursor_name left_ptr -solid black -name root-window") + +;; start the polling timer process +(start-clipboard-manager) + +(run-shell-command "feh --bg-fill ~/Pictures/calif-soviet.png") +(run-shell-command "xgamma -gamma .8") +(toggle-mode-line (current-screen) + (current-head)) diff --git a/init.lisp b/init.lisp new file mode 100644 index 0000000..d56b6b0 --- /dev/null +++ b/init.lisp @@ -0,0 +1,7 @@ +(in-package #:stumpwm-init) + +;; Yikes. Handle them instead? +(ignore-errors + (create-server :port 4004 + :style slynk:*communication-style* + :dont-close t)) diff --git a/keybindings.lisp b/keybindings.lisp new file mode 100644 index 0000000..9d9ccad --- /dev/null +++ b/keybindings.lisp @@ -0,0 +1,43 @@ +(in-package #:stumpwm-init) + +(define-key *top-map* (kbd "M-`") "show-menu") + +(set-prefix-key (kbd "C-i")) +(define-key *root-map* (kbd "c") "xterm") +(define-key *root-map* (kbd "C-c") "xterm") +(define-key *root-map* (kbd "E") "emacs") +(define-key *root-map* (kbd "d") "poison") +(define-key *root-map* (kbd "B") "browse") +(define-key *root-map* (kbd "C-y") "show-clipboard-history") + +(define-remapped-keys + '(("(Firefox|Tor)" + ;; navigation + ("C-j" . "Down") ; by line + ("C-k" . "Up") + ("C-b" . "S-SPC") ; by page + ("C-f" . "SPC") + ("M-<" . "Home") ; to top/botom + ("M->" . "End") + ("C-y" . "C-v") ;paste + ("C-g" . "ESC") + ("M-x" . "C-j") ; search bar focus + ;; find search + ("C-s" . "C-f") ; search in page + ("C-n" . "C-g") ; next match + ("C-p" . "C-G") ; prev match + ;; other useful ones: + ;; C-pgup/c-pgdown cycle tabs + ;; C-w kill tab + ("C-w" . "C-w")))) +(define-remapped-keys + '(("Okular" + ("C-j" . "Down") + ("C-k" . "Up") + ("C-b" . "S-SPC") + ("C-f" . "SPC") + ("C-s" . "C-f") + ("M-w" . "C-c") + ("C-y" . "C-v") + ("M->" . "C-End") + ("M-<" . "C-Home")))) diff --git a/package.lisp b/package.lisp new file mode 100644 index 0000000..ce0cfff --- /dev/null +++ b/package.lisp @@ -0,0 +1,31 @@ +(defpackage #:stumpwm-init + (:use #:cl) + (:import-from :alexandria :once-only) + (:import-from :clipboard-history :start-clipboard-manager) + (:import-from :slynk :create-server) + (:import-from + :stumpwm + :banish + :current-screen + :current-head + :defcommand + :define-key + :define-remapped-keys + :kbd + :*mode-line-background-color* + :*mode-line-border-color* + :*mode-line-foreground-color* + :*mode-line-foreground-color* + :*mode-line-timeout* + :*root-map* + :run-shell-command + :*screen-mode-line-format* + :set-prefix-key + :toggle-mode-line + :*top-map* + :*window-format*) + (:export + :*my-mouse* ;Set for the `poison' command to toggle it. + :*xterm-font* ;;settings for xterm to look nice. + :*xterm-font-pt* + :*app-menu*)) diff --git a/stumpwm-init.asd b/stumpwm-init.asd new file mode 100644 index 0000000..598f30c --- /dev/null +++ b/stumpwm-init.asd @@ -0,0 +1,32 @@ +(asdf:defsystem #:stumpwm-init + :description "My custom stumpwm init." + :author "Spenser Truex <web@spensertruex.com>" + :license "Specify license here" + :version "0.0.1" + :serial t ;; TODO: Not serial. + + ;; TODO: Weakly depends on (but not, since that is deprecated)? + :depends-on (;; quicklisp + :alexandria + :cffi + :stumpwm + :usocket-server + :slynk + :percent-encoding + + ;; stumpwm-contrib + :shell-command-history + :command-history + :battery-portable + :browse + :pinentry + :pass + :clipboard-history + :app-menu) + :components ((:file "package") + (:file "init") + (:file "util") + (:file "config") + (:file "commands") + (:file "keybindings") + (:file "finalize"))) diff --git a/util.lisp b/util.lisp new file mode 100644 index 0000000..65d76b8 --- /dev/null +++ b/util.lisp @@ -0,0 +1,9 @@ +(in-package #:stumpwm-init) +(defmacro deftermcom (name + &optional argstr (termcom 'xterm)) + "Call a terminal with arguments." + (once-only (argstr) + `(defcommand ,name () () + (if ,argstr + (,termcom ,argstr) + (,termcom)))))