;;;; -*- Mode: Lisp -*- ;; ;; vim: filetype=lisp ;; ;; Compiled using ANSI Common Lisp; not SBCL. ;; SBCL just made stumpwm run so slow, so I read that it actually runs ;; faster with Clisp, so I immediately undertook the process of compiling ;; stumpwm using Clisp. (in-package :stumpwm) ;; not sure what this does. ;; Emergency Key Bindings ; key bindings that will be set up in case of a problem in this .*rc file. (define-key *top-map* (kbd "s-E") ; enables the user to interact with the openbox logout script "exec oblogout") (define-key *top-map* (kbd "s-T") ; enables the user to start up an emergency session of a terminal "exec terminator") (define-key *top-map* (kbd "C-M-F") ; the 'failsafe' method xD "exec killall -s KILL stumpwm") ;; Modules ;(load "/home/gm/opt/stumpwm/contrib/battery-portable.lisp") ;(load "/home/gm/opt/stumpwm/contrib/battery.lisp") ;(load "/home/gm/opt/stumpwm/contrib/mpd.lisp") ;(load "/home/gm/opt/stumpwm/contrib/productivity.lisp") ;(load "/home/gm/opt/stumpwm/contrib/app-menu.lisp") ;; Background setup (run-shell-command "feh --bg-max ~/picts/'Washington DC'.jpg") ;; Startup message ;(setf *start-up* nil) (setf *startup-message* "Blarg") ;; Modeline ;(setf *mode-line-foreground-color* "White") ;(setf *mode-line-background-color* "Black") ;(setf *mode-line-border-color* "Black") ;(setf *group-format* "%t") ;(setf *window-name-source* :title) ;(setf *window-format* "%c") ;(setf *screen-mode-line-format* (list " ^B^7*((^6*" ; '(:eval (run-shell-command "date '+%I:%M%P' |tr -d [:cntrl:]" t)) ; "^7*) (^6*%B^7*)" ; " ^7*(^6%g" ; " ^7*(^6*%w^7*)))")) ; ;(if (not (head-mode-line (current-head))) ; (toggle-mode-line (current-screen) (current-head))) ;; Mouse and Fonts (run-shell-command "xsetroot -cursor_name left_ptr") (setf *mouse-focus-policy* :click) ;; Mouse Mappings ;(defstruct mouse-event button state root-x root-y) ;;; This is a little bit uggly but this prevent to redefine all the ;;; interactive-command way. ;(defvar *current-mouse-event* nil) ;(defvar *ignore-next-mouse-event* nil) ;(defvar *frame-number-wins* nil) ;;; Little helpers ;(defun define-mouse (map button command) ; (define-key map button command)) ;(defun button (buttons) ; (kbd buttons)) ;(define-key *top-map* (button "1") "der-men") ;;; Default binding ;(defparameter *mouse-map* ; (let ((m (make-sparse-keymap))) ; (define-mouse m (button "1") "der-men") ; m)) ;; Windows an' Messages ;None, yet. ;; Taskbar (run-shell-command "tint2") ;(run-shell-command "sh :B/ensur-tint2.sh") ;; Menu ; an experimental menu that uses plists. (defvar *exp-Books* (list :Common\ \Lisp\ General\ \Documentation "zathura /home/gm/docs/books/Lisp.pdf" :\On\ \Lisp "zathura /home/gm/docs/books/onlisp.pdf" :\The\ Collected\ Works\ of\ J.R.R.\ Tolkien "zathura /home/gm/docs/books/'The Collected Works of J.R.R. Tolkien.pdf'" :\The\ Tolkien\ Binder "zathura /home/gm/docs/books/Binder1.pdf" :Compaq\ Presario\ CQ60\ Maintenance\ \and\ Service\ Guide "zathura /home/gm/docs/books/maintenance.pdf")) (defun *exp-menu* () (setf *exp-Main* (list :Books *exp-Books*)) ) ; the regular app-menu that is all too available and un-explained. (defparameter *app-menu* '(("Books" ;; a submenu ("Common Lisp General Documentation" "zathura /home/gm/docs/books/Lisp.pdf") ("On Lisp" "zathura /home/gm/docs/books/onlisp.pdf") ("The Collected Works of J.R.R. Tolkien" "zathura /home/gm/docs/books/'The Collected Works of J.R.R. Tolkien.pdf'") ("The Tolkien Binder" "zathura /home/gm/docs/books/Binder1.pdf") ("Compaq Presario CQ60 Maintenance and Service Guide" "zathura /home/gm/docs/books/maintenance.pdf")) ("All Programs" ("Accessories" ; the accessories submenu ("Xterm" "xterm") ("gvim" "gvim")) ("Internet" ("Chromium" "chromium")) ))) (define-key *top-map* (kbd "s-SPC") "der-men") ;(define-key (defcommand der-men () () "parses the '*app-menu*' variable allowing users to access a menu." (labels ((pick (options) (let ((selection (stumpwm::select-from-menu (current-screen) options ""))) (cond ((null selection) (throw 'stumpwm::error "Okay.")) ((stringp (second selection)) (second selection)) (t (pick (cdr selection)) ))) )) (let ((choice (pick *app-menu*))) (run-shell-command choice)) )) ;; Commands ;(defcommand reloadrc () () ; "docstring" ; "/bin/sh -c pkill -HUP stumpwm") ;(defcommand donothing () () ; "do nothing") ;(defcommand reinit () ; "exec sh bin/stump-restart.sh") (defcommand reloadrc () () "docstring" (run-commands "loadrc")) ;(defun shift-windows-forward (frames win) ; (when frames ; (let ((frame (car frames))) ; (shift-windows-forward (cdr frames) ; (frame-window frame)) ; (when win ; (pull-window win frame))))) ;(defcommand rotate-windows () () ; (let* ((frames (group-frames (current-group))) ; (win (frame-window (car (last frames))))) ; (shift-windows-forward frames win))) ;(defcommand other-win () () ; (run-commands "other" "windows")) (defcommand next-win () () "docstring" (run-commands "next" "windows")) (defcommand prev-win () () "docstring" (run-commands "prev" "windows")) ;(defcommand next-in-frame-win () () ; (run-commands "next-in-frame" "windows")) ;(defcommand prev-in-frame-win () () ; (run-commands "prev-in-frame" "windows")) ;; toggle between vertical split and horizontal split ;(defcommand toggle-split () () ; (let* ((group (current-group)) ; (cur-frame (tile-group-current-frame group)) ; (frames (group-frames group))) ; (if (eq (length frames) 2) ; (progn (if (or (neighbour :left cur-frame frames) ; (neighbour :right cur-frame frames)) ; (progn ; (only) ; (vsplit)) ; (progn ; (only) ; (hsplit)))) ; (message "Works only with 2 frames")))) ;(defun pinger-for-pingit (ip-or-fqdn) ; see my comment about pingit below. ; (setf command (concatenate 'string "exec xterm -e" "ping" " " ip-or-fqdn "&&" "sh")) ; (run-shell-command command)) ; I have no idea if this command even works or not. ;(defcommand pingit (ip-or-fqdn) ; (if (eql nil ip-or-fqdn) (format t "variable is empty; variable must not be empty") (pinger-for-pingit ip-or-fqdn))) ; ;(defcommand mk-folder (folder-to-make folder-to-make-in) ; (setf command (concatenate 'string "cd" " " folder-to-make-in)) ; (run-shell-command command) ; (setf command (concatenate 'string "mkdir" " " folder-to-make)) ; (run-shell-command command) ; (run-shell-command "send-notify 'folder made'")) ;; Groups (grename "0")(gnewbg "1")(gnewbg "2") (gnewbg "3") (gnewbg "4") ;(gnewbg "4")(gnewbg "5") ;; display the key sequence in process/progress ;(defun key-press-hook (key-seq cmd) ; (declare (ignore key)) ;(unless (eq *top-map* *resize-map*) ; (let ((*message-window-gravity* :bottom-right)) ; (message "Key sequence: ~a" (print-key-seq (reverse key-seq)))) ; (when (stringp cmd) ; ;; give 'em time to read it ; (sleep 0.5)))) ;(defmacro replace-hook (hook fn) ; `(remove-hook ,hook ,fn) ; `(add-hook ,hook ,fn)) ;(replace-hook *key-press-hook* 'key-press-hook) ;; Super_L is supposed to be the windows key.. but it doesn't seem to work. Oh, duh. Windows key represented by the M in Meta ;; ;; width in pixels given to the borders of windows with maxsize or ratio (setf *maxsize-border-width* 1) ;; width in pixels given to th eborders of transient of pop-up windows (setf *transient-border-width* 1) ;; width in pixels given to the borders of regular windows (setf *normal-border-width* 1) ;; set the border color for focused windows (set-focus-color "black") ; `white' by default (set-unfocus-color "yellow") ;; ; symbolic keybindings ;(define-keysym #xffe3 "Control_L") ;(define-keysym #xffeb "Super_L") ;(define-keysym #xff14 "Scroll_Lock") ;(define-keysym #xffe9 "Alt_L") ;; I have specified which alt keys are which ;(define-keysym #xffe7 "Meta_L") ;; so that I can have certain keybindings ;(define-keysym #xffea "Alt_R") ;; that will only be triggered if a certain ;(define-keysym #xffe8 "Meta_R") ;; sequence of modifier keys is used. ;(define-keysym #xffe2 "Shift_R");; And so that Ix can have single-key bindings ;(define-keysym #xffe1 "Shift_L");; that only make use of a single modifier key ;; something which does not appear to be possible by default. (define-keysym #x1008ffa9 "XF86TouchpadToggle") ;(define-keysym #xffab "plus") ; this mapping defaults to "KP_Add") ;(define-keysym #xffad "minus") ; '' "KP_Subtract") ;(define-keysym #xffaa "asterisk") ; '' "KP_Multiply") ;(define-keysym #xffaf "slash") ; '' "KP_Divide") ; dmenu setup (define-key *top-map* (kbd "Menu") "exec dmenu_run -p \">_\" -nb '#191919'" );;-sb '#C0CC00' -sf '#000000' -nb '#191919' -nf 'grey' " ) ; dmenfm setup (define-key *top-map* (kbd "M-.") "exec dmenfm") ;; (define-key *top-map* (kbd "XF86Sleep") "exec xterm -e sudo pm-suspend") (define-key *top-map* (kbd "XF86PowerOff") "exec oblogout") (define-key *top-map* (kbd "XF86AudioMute") "exec amixer set Master toggle") (define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer set Master 1%-") (define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer set Master 1%+") (define-key *top-map* (kbd "Print") "exec scrot") ;(define-key *top-map* (kbd "XF86WLAN") (define-key *top-map* (kbd "XF86HomePage") "exec chromium") (define-key *top-map* (kbd "s-F6") "exec xscreensaver") (define-key *top-map* (kbd "XF86TouchpadToggle") "exec sh ~/bin/chkpad.sh") ;; ;(define-key *top-map* (kbd "M-Tab") ; "next-win") ;(define-key *top-map* (kbd "M-ISO_Left_Tab") ; "prev-win") ;(define-key *top-map* (kbd "C-M-Delete") ; "exec xterm -e htop") ;; ;;** Prefix Key (set-prefix-key (kbd "s-x")) ; sets the prefix key to Windows-key + the letter 'x'. The prefix key is Ctrl-t, by default. (it's a rather awkward key-binding, imo.) ;; EOF