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