;;;; -*- Mode: Lisp -*- ;; ;; vim: filetype=lisp (in-package :stumpwm) (set-font "-xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso8859-1") ;; Modules (load "/opt/stumpwm/contrib/battery-portable.lisp") ;(load "/opt/stumpwm/contrib/amixer.lisp") ;; Startup message (setf *startup-message* nil) (setf *startup-message* "O hey, Mark!") ;; 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* :sloppy) ;;Windows and Messages (defparameter *foreground-color* "White") (defparameter *background-color* "Black") (defparameter *border-color* "Dark Slate Gray") (setf *message-window-gravity* :top-right) (setf *input-window-gravity* :top-right) (set-fg-color *foreground-color*) (set-bg-color *background-color*) (set-border-color *border-color*) (set-msg-border-width 0) (setf *window-border-style* :thin) (set-focus-color *foreground-color*) (set-unfocus-color *background-color*) (setf *normal-border-width* 0) (setf *maxsize-border-width* 0) (setf *transient-border-width* 0) (set-frame-outline-width 0) ;;Groups (grename "1") (gnewbg "2") (gnewbg "3") (gnewbg "4") ;; Prefix key (set-prefix-key (kbd "Menu")) ;; -special keys (define-keysym #x1008ff95 "XF86WLAN") (define-keysym #x1008ff93 "XF86Battery") (define-keysym #x1008ff13 "XF86AudioRaiseVolume") (define-keysym #x1008ff11 "XF86AudioLowerVolume") (define-keysym #x1008ff12 "XF86AudioMute") (define-keysym #x1008ff02 "XF86MonBrightnessUp") (define-keysym #x1008ff03 "XF86MonBrightnessDown") (define-keysym #x1008ff2f "XF86Sleep") ;; Commands (defcommand colon1 (&optional (initial "")) (:rest) "For use with interactive commands." (let ((cmd (read-one-line (current-screen) ": " :initial-input initial))) (when cmd (eval-command cmd t)))) ;; -brightness (defcommand UpBrightness () () "Turn up brightness" (run-shell-command "exec xbacklight -set 100")) (defcommand DownBrightness () () "Turn down brightness" (run-shell-command "exec xbacklight -set 50 -steps 1")) (defcommand goodnight () () ;;for use with acpid/XF86Sleep "Display text" (echo-string (current-screen) "Good night!")) (defcommand off () () "Display text" (echo-string (current-screen) "Goodbye!") (run-shell-command "exec sudo poweroff")) (defcommand reboot () () "Display text" (echo-string (current-screen) "See ya!") (run-shell-command "exec sudo reboot")) (defcommand snapshot () () "Display text" (echo-string (current-screen) "Taking Snapshot") (run-shell-command "exec scrot '%m.%d.%Y_%I:%M:%S_%P.png' -e 'mv $f ~/Images/snapshots'")) (defparameter term "exec urxvt +sb -rv -bc -cr white -fn -*-terminus-*-*-*-*-12-*-*-*-*-*-*-*") (defparameter stumpish (concat term " -e /opt/stumpwm/contrib/stumpish")) (defparameter wicd (concat term " -e wicd-curses")) (defcommand terminal () () "Display text" (run-shell-command term)) (defcommand stumpish-terminal () () "Display text" (run-shell-command stumpish)) (define-key *root-map* (kbd "c") "terminal") (define-key *root-map* (kbd "C-s") "stumpish-terminal") (define-key *root-map* (kbd "B") "reboot") (define-key *root-map* (kbd "P") "off") (define-key *root-map* (kbd "w") "exec conkeror") (define-key *top-map* (kbd "s-w") "exec conkeror") (define-key *top-map* (kbd "s-c") "terminal") (define-key *top-map* (kbd "s-e") "emacs") (define-key *top-map* (kbd "XF86WLAN") wicd) (define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer sset Master 5+") (define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer sset Master 5-") (define-key *top-map* (kbd "XF86AudioMute") "exec amixer sset Master toggle") (define-key *top-map* (kbd "XF86MonBrightnessUp") "UpBrightness") (define-key *top-map* (kbd "XF86MonBrightnessDown") "DownBrightness") (define-key *top-map* (kbd "XF86Sleep") "goodnight") (define-key *top-map* (kbd "Print") "snapshot") ;; Menu (defparameter *app-menu* '(("Books" ;;submenu ("COMMON LISP: A Gentle Introduction to Symbolic Computation" "llpp /home/rich/Documents/book.pdf") ("The Linux Command Line" "llpp /home/rich/Documents/TLCL-09.12.pdf")) ("Internet" ;; sub menu ("Conkeror" "conkeror") ("Elinks" "urxvt +sb -rv -bc -cr white -fn \"xft:DejaVu Sans Mono:pixelsize=12:\" -e elinks")))) (define-key *root-map* (kbd ".") "mymenu") (defcommand mymenu () () "Display text" (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)))) ;; Navigation ;; - swap windows (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 () () "Display text" (let* ((frames (group-frames (current-group))) (win (frame-window (car (last frames))))) (shift-windows-forward frames win))) (defcommand other-win () () "Display text" (run-commands "other" "windows")) (defcommand next-win () () "Display text" (run-commands "next" "windows")) (defcommand prev-win () () "Display text" (run-commands "prev" "windows")) ;(defcommand next-in-frame-win () () ; (run-commands "next-in-frame" (run-shell-command stumpwm:run-with-timer 1 () (run-shell-command "windows")))) (defcommand prev-in-frame-win () () "Display text" (run-commands "prev-in-frame" "windows")) ;; toggle between vertical split and horizontal split (defcommand toggle-split () () "Display text" (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")))) (defparameter *layouts* (make-hash-table :test #'eql)) (defcommand toggle-full-layout () () (let* ( (gnum (group-number (current-group))) (currlay (gethash gnum *layouts*)) ) (if currlay (progn (restore-group (current-group) currlay) (setf (gethash gnum *layouts*) nil)) (progn (setf (gethash gnum *layouts*) (dump-group (current-group))) (run-commands "only")) ) ) ) (define-key *top-map* (kbd "s-q") "toggle-full-layout") (define-key *top-map* (kbd "s-1") "gselect 1") (define-key *top-map* (kbd "s-2") "gselect 2") (define-key *top-map* (kbd "s-3") "gselect 3") (define-key *top-map* (kbd "s-4") "gselect 4") (define-key *top-map* (kbd "s-`") "rotate-windows") (define-key *top-map* (kbd "s-Tab") "other-win") (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 "s-SPC") "next-in-frame-win") (define-key *top-map* (kbd "S-s-SPC") "prev-in-frame-win") (define-key *top-map* (kbd "s-s") "vsplit") (define-key *top-map* (kbd "s-S") "hsplit") ;(define-key *top-map* (kbd "s-q") "only") (define-key *top-map* (kbd "s-k") "delete") (define-key *top-map* (kbd "s-K") "kill") (define-key *top-map* (kbd "s-~") "toggle-split") ;; EOF