ansible/roles/dotfiles/files/.stumpwmrc

228 lines
17 KiB
Common Lisp

Content-Type: text/enriched
Text-Width: 70
;; <x-color><param>#565766</param>-*-lisp-*-
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;;; <x-color><param>#565766</param>INDEX ;;;
</x-color>;;; <x-color><param>#565766</param>- DEPRECATED - MANIFEST ;;;
</x-color>;;; <x-color><param>#565766</param>- SWANK INTERACTION ;;;
</x-color>;;; <x-color><param>#565766</param>- GENERAL CONFIG ;;;
</x-color>;;; <x-color><param>#565766</param>- UTILITY FUNCTIONS ;;;
</x-color>;;; <x-color><param>#565766</param>- KEY BINDING ;;;
</x-color>;;; <x-color><param>#565766</param>- EXECUTION ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;;; <x-color><param>#565766</param>DEPRECATED - MANIFEST ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;; <x-color><param>#565766</param>without the ability to select localhost-only, we can't use
</x-color>;; <x-color><param>#565766</param>manifest at this time.
</x-color>;; <x-color><param>#565766</param>(defvar *manifest-url*
</x-color>;; <x-color><param>#565766</param>(manifest:start))
</x-color>;; <x-color><param>#565766</param>(defun browse-manifest ()
</x-color>;; <x-color><param>#565766</param>(format nil "exec ~A ~A" *default-browser* *manifest-url*))
</x-color>;; <x-color><param>#565766</param>(define-key *root-map* (kbd "C-d") (browse-manifest))
</x-color>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;;; <x-color><param>#565766</param>SWANK INTERACTION ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;; <x-color><param>#565766</param>swank interaction allows us to connect to the StumpWM
</x-color>;; <x-color><param>#565766</param>process from emacs while it's running.
</x-color>
(ql:quickload <x-color><param>#a3646f</param>:swank</x-color>)
(<x-color><param>#93e57c</param>let</x-color> ((server-running nil))
(defcommand swank () ()
<x-color><param>#627e95</param>"Toggle the swank server on/off"</x-color>
(<x-color><param>#93e57c</param>if</x-color> server-running
(<x-color><param>#93e57c</param>progn</x-color>
(swank:stop-server 4005)
(echo-string
(current-screen)
<x-color><param>#627e95</param>"Stopping swank."</x-color>)
(setf server-running nil))
(<x-color><param>#93e57c</param>progn</x-color>
(swank:create-server <x-color><param>#a3646f</param>:port</x-color> 4005
<x-color><param>#a3646f</param>:style</x-color> swank:*communication-style*
<x-color><param>#a3646f</param>:dont-close</x-color> t)
(echo-string
(current-screen)
<x-color><param>#627e95</param>"Starting swank. M-x slime-connect RET RET, then (in-packqage stumpwm)."</x-color>)
(setf server-running t)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;;; <x-color><param>#565766</param>GENERAL CONFIG ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;; <x-color><param>#565766</param>this is where configuration parameters, the frame numbering
</x-color>;; <x-color><param>#565766</param>and switching, and other general configuration is set up.
</x-color>
(<x-color><param>#93e57c</param>defparameter</x-color> <x-color><param>#9e79b3</param>*default-browser*</x-color> <x-color><param>#627e95</param>"firefox"</x-color>)
(<x-color><param>#93e57c</param>defparameter</x-color> <x-color><param>#9e79b3</param>*default-terminal*</x-color> <x-color><param>#627e95</param>"mate-terminal"</x-color>)
;; <x-color><param>#565766</param>make frames 1-numbered (i.e. for getting with ALT-FN)
</x-color>(setf *frame-number-map* <x-color><param>#627e95</param>"1234567890"</x-color>)
(run-commands
<x-color><param>#627e95</param>"gnewbg G2"</x-color> ;; <x-color><param>#565766</param>F2
</x-color> <x-color><param>#627e95</param>"gnewbg G3"</x-color> ;; <x-color><param>#565766</param>F3
</x-color> <x-color><param>#627e95</param>"gnewbg G4"</x-color> ;; <x-color><param>#565766</param>F4
</x-color> <x-color><param>#627e95</param>"gnewbg G5"</x-color> ;; <x-color><param>#565766</param>F5
</x-color> <x-color><param>#627e95</param>"gnewbg G6"</x-color> ;; <x-color><param>#565766</param>F6
</x-color> <x-color><param>#627e95</param>"gnewbg G7"</x-color> ;; <x-color><param>#565766</param>F7
</x-color> <x-color><param>#627e95</param>"gnewbg G8"</x-color> ;; <x-color><param>#565766</param>F8
</x-color> <x-color><param>#627e95</param>"gnewbg G9"</x-color> ;; <x-color><param>#565766</param>F9
</x-color> <x-color><param>#627e95</param>"gnewbg G10"</x-color> ;; <x-color><param>#565766</param>F10
</x-color> <x-color><param>#627e95</param>"gnewbg G11"</x-color> ;; <x-color><param>#565766</param>F11
</x-color> <x-color><param>#627e95</param>"gnewbg G12"</x-color>
<x-color><param>#627e95</param>"gnewbg G13"</x-color>
<x-color><param>#627e95</param>"gnewbg G14"</x-color>
<x-color><param>#627e95</param>"gnewbg G15"</x-color>
<x-color><param>#627e95</param>"gnewbg G16"</x-color>
<x-color><param>#627e95</param>"gnewbg G17"</x-color>
<x-color><param>#627e95</param>"gnewbg G18"</x-color>
<x-color><param>#627e95</param>"gnewbg G19"</x-color>)
;; <x-color><param>#565766</param>Fluxbox-style Alt-F# virtual desktop (group in StumpWM-speak)
</x-color>;; <x-color><param>#565766</param>switching. Modified from:
</x-color>;; <x-color><param>#565766</param>http://hcl-club.lu/svn/development/lisp/.stumpwmrc
</x-color>(<x-color><param>#93e57c</param>loop</x-color> for i from 1 to 9
do
(<x-color><param>#93e57c</param>progn</x-color>
(format t <x-color><param>#627e95</param>"Key: ~A~%"</x-color> i)
(define-key *top-map*
(kbd (format nil <x-color><param>#627e95</param>"M-~a"</x-color> i))
(format nil <x-color><param>#627e95</param>"gselect ~a"</x-color> i))))
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-!"</x-color>) <x-color><param>#627e95</param>"gselect 10"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-@"</x-color>) <x-color><param>#627e95</param>"gselect 11"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-#"</x-color>) <x-color><param>#627e95</param>"gselect 12"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-$"</x-color>) <x-color><param>#627e95</param>"gselect 13"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-%"</x-color>) <x-color><param>#627e95</param>"gselect 14"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-^"</x-color>) <x-color><param>#627e95</param>"gselect 15"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-&"</x-color>) <x-color><param>#627e95</param>"gselect 16"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-*"</x-color>) <x-color><param>#627e95</param>"gselect 17"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-\("</x-color>) <x-color><param>#627e95</param>"gselect 18"</x-color>)
(define-key *top-map* (kbd <x-color><param>#627e95</param>"M-\)"</x-color>) <x-color><param>#627e95</param>"gselect 19"</x-color>)
;; <x-color><param>#565766</param>set FFM
</x-color>(setf *mouse-focus-policy* <x-color><param>#a3646f</param>:sloppy</x-color>)
;; <x-color><param>#565766</param>show input bar in centre of screen
</x-color>(setf *input-window-gravity* <x-color><param>#a3646f</param>:center</x-color>)
;; <x-color><param>#565766</param>enable the mode-line (and preferably the system tray)
</x-color>(setf *mode-line-position* <x-color><param>#a3646f</param>:bottom</x-color>)
(load-module <x-color><param>#627e95</param>"stumptray"</x-color>)
(<x-color><param>#93e57c</param>dolist</x-color>
(head (screen-heads (current-screen)))
(toggle-mode-line (current-screen) head))
(stumptray::stumptray)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;;; <x-color><param>#565766</param>UTILITY FUNCTIONS ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>
(defcommand acpi-status () ()
<x-color><param>#627e95</param>"Print ACPI status in the StumpWM message box."</x-color>
(stumpwm:echo-string (current-screen)
(<x-color><param>#93e57c</param>with-output-to-string</x-color> (stream)
(sb-ext:run-program
<x-color><param>#627e95</param>"/usr/bin/acpitool"</x-color>
nil
<x-color><param>#a3646f</param>:output</x-color> stream))))
(defcommand lock () ()
<x-color><param>#627e95</param>"Lock the screen by invoking i3lock."</x-color>
(stumpwm:echo-string (current-screen) <x-color><param>#627e95</param>"Locking screen..."</x-color>)
(sb-ext:run-program <x-color><param>#627e95</param>"/usr/bin/i3lock"</x-color> nil))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>exec-for-status</x-color> (path <x-color><param>#5992c2</param>&rest</x-color> args)
<x-color><param>#565766</param>"Run the path with args and return the status code."</x-color>
(sb-ext:process-exit-code
(sb-ext:run-program path args <x-color><param>#a3646f</param>:wait</x-color> t)))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>exec-ok</x-color> (path <x-color><param>#5992c2</param>&rest</x-color> args)
<x-color><param>#565766</param>"Returns true if path with args ran without error."</x-color>
(zerop (exec-for-status path args)))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>daemon-is-running</x-color> (daemon)
(zerop (exec-for-status <x-color><param>#627e95</param>"/usr/bin/pgrep"</x-color> daemon)))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>start-daemon-if-not-running</x-color> (path <x-color><param>#5992c2</param>&rest</x-color> args)
<x-color><param>#565766</param>"If the program specified at path isn't running, start it."</x-color>
(<x-color><param>#93e57c</param>when</x-color> (not (daemon-is-running (pathname-name path)))
(run-shell-command (<x-color><param>#93e57c</param>if</x-color> (null args)
path
(format nil <x-color><param>#627e95</param>"~A~{ ~A~}"</x-color> path args)))))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>start-program-if-not-running</x-color> (program <x-color><param>#5992c2</param>&rest</x-color> args)
(format t <x-color><param>#627e95</param>"WOULD RUN: nohup ~A~{ ~A~}"</x-color> program args)
(<x-color><param>#93e57c</param>when</x-color> (not (exec-ok <x-color><param>#627e95</param>"/usr/bin/pgrep"</x-color> program))
(run-shell-command (format nil <x-color><param>#627e95</param>"nohup ~A~{ ~A~}"</x-color>
program args))))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>with-terminal</x-color> (<x-color><param>#5992c2</param>&key</x-color> (run <x-color><param>#627e95</param>""</x-color> run-p) (term *default-terminal*))
(concat <x-color><param>#627e95</param>"exec "</x-color> term (<x-color><param>#93e57c</param>if</x-color> run-p <x-color><param>#627e95</param>" -e "</x-color> <x-color><param>#627e95</param>""</x-color>) run))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>with-homedir</x-color> (path)
(merge-pathnames path (user-homedir-pathname)))
(<x-color><param>#93e57c</param>defun</x-color> <x-color><param>#beb7f7</param>in-homedir-p</x-color> (path)
(probe-file (<x-color><param>#93e57c</param>with-homedir</x-color> path)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>;;; <x-color><param>#565766</param>DEMON^WKEY BINDING ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>#565766</param>
</x-color>
(define-key stumpwm:*root-map* (kbd <x-color><param>#627e95</param>"B"</x-color>) <x-color><param>#627e95</param>"exec firefox"</x-color>)
(define-key stumpwm:*root-map* (kbd <x-color><param>#627e95</param>"c"</x-color>) (<x-color><param>#93e57c</param>with-terminal</x-color>))
(define-key *root-map* (kbd <x-color><param>#627e95</param>"b"</x-color>) <x-color><param>#627e95</param>"acpi-status"</x-color>)
(define-key *root-map* (kbd <x-color><param>#627e95</param>"RET"</x-color>) (<x-color><param>#93e57c</param>with-terminal</x-color>))
(define-key *root-map* (kbd <x-color><param>#627e95</param>"d"</x-color>) <x-color><param>#627e95</param>"exec dmenu_run"</x-color>)
(define-key *root-map* (kbd <x-color><param>#627e95</param>"D"</x-color>) <x-color><param>#627e95</param>"exec i3-dmenu-desktop"</x-color>)
(define-key *root-map* (kbd <x-color><param>#627e95</param>"e"</x-color>) <x-color><param>#627e95</param>"exec emacsclient -c -a \"\""</x-color>)
(define-key *root-map* (kbd <x-color><param>#627e95</param>"E"</x-color>) (<x-color><param>#93e57c</param>with-terminal</x-color> <x-color><param>#a3646f</param>:run</x-color> <x-color><param>#627e95</param>"'emacsclient -c -nw -a \"\"'"</x-color>))
(define-key *root-map* (kbd <x-color><param>#627e95</param>"g"</x-color>) (<x-color><param>#93e57c</param>with-terminal</x-color> <x-color><param>#a3646f</param>:run</x-color> <x-color><param>#627e95</param>"ghci"</x-color>))
(define-key *root-map* (kbd <x-color><param>#627e95</param>"C-i"</x-color>) (<x-color><param>#93e57c</param>with-terminal</x-color> <x-color><param>#a3646f</param>:run</x-color> <x-color><param>#627e95</param>"ipython"</x-color>))
(define-key *root-map* (kbd <x-color><param>#627e95</param>"l"</x-color>) <x-color><param>#627e95</param>"lock"</x-color>)
(define-key *root-map* (kbd <x-color><param>#627e95</param>"C-l"</x-color>) (<x-color><param>#93e57c</param>with-terminal</x-color> <x-color><param>#a3646f</param>:run</x-color> <x-color><param>#627e95</param>"rlwrap sbcl"</x-color>))
(<x-color><param>Purple</param>define-key</x-color> *root-map* (kbd <x-color><param>VioletRed4</param>"M"</x-color>) (<x-color><param>Purple</param>with-terminal</x-color> <x-color><param>dark slate blue</param>:run</x-color> <x-color><param>VioletRed4</param>"htop"</x-color>))
(<x-color><param>Purple</param>define-key</x-color> *root-map* (kbd <x-color><param>VioletRed4</param>"C-s"</x-color>) <x-color><param>VioletRed4</param>"swank"</x-color>)
(<x-color><param>Purple</param>define-key</x-color> *root-map* (kbd <x-color><param>VioletRed4</param>"C-v"</x-color>) <x-color><param>VioletRed4</param>"exec pavucontrol"</x-color>)
(<x-color><param>Purple</param>define-key</x-color> *root-map* (kbd <x-color><param>VioletRed4</param>"w"</x-color>) (<x-color><param>Purple</param>with-terminal</x-color> <x-color><param>dark slate blue</param>:run</x-color> <x-color><param>VioletRed4</param>"nmtui-connect"</x-color>))
(<x-color><param>Purple</param>define-key</x-color> *root-map* (kbd <x-color><param>VioletRed4</param>"`"</x-color>) <x-color><param>VioletRed4</param>"scratch-pad"</x-color>)
(<x-color><param>Purple</param>define-key</x-color> *root-map* (kbd <x-color><param>VioletRed4</param>"~"</x-color>) <x-color><param>VioletRed4</param>"scratch-pad-float"</x-color>)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>Firebrick</param>
</x-color>;;; <x-color><param>Firebrick</param>EXECUTION ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>Firebrick</param>
</x-color>
(run-shell-command <x-color><param>VioletRed4</param>"ssh-add"</x-color>)
(<x-color><param>Purple</param>when</x-color> (in-homedir-p <x-color><param>VioletRed4</param>".fehbg"</x-color>)
(sb-ext:run-program <x-color><param>VioletRed4</param>"/bin/sh"</x-color> (<x-color><param>Purple</param>with-homedir</x-color> <x-color><param>VioletRed4</param>".fehbg"</x-color>)))
(<x-color><param>Purple</param>when</x-color> (in-homedir-p <x-color><param>VioletRed4</param>".screenlayouts/norminal.sh"</x-color>)
(run-shell-command (<x-color><param>Purple</param>with-homedir</x-color> <x-color><param>VioletRed4</param>".screenlayouts/norminal.sh"</x-color>)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>Firebrick</param>
</x-color>;;; <x-color><param>Firebrick</param>THIS BATTLESTATION IS FULLY OPERATIONAL ;;;
</x-color>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<x-color><param>Firebrick</param>
</x-color>(message <x-color><param>VioletRed4</param>"Ready."</x-color>)
;;<x-color><param>Firebrick</param>LISP=sbcl
</x-color>