Advertisement
Guest User

.stumpwmrc

a guest
Apr 4th, 2012
456
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 8.42 KB | None | 0 0
  1. ;;;; -*- Mode: Lisp -*-
  2. ;;
  3. ;; vim: filetype=lisp
  4.  
  5. (in-package :stumpwm)
  6.  
  7. (set-font "-xos4-terminus-medium-r-normal--12-120-72-72-c-60-iso8859-1")
  8.  
  9. ;; Modules
  10. (load "/opt/stumpwm/contrib/battery-portable.lisp")
  11. ;(load "/opt/stumpwm/contrib/amixer.lisp")
  12.  
  13.  
  14. ;; Startup message
  15. (setf *startup-message* nil)
  16. (setf *startup-message* "O hey, Mark!")
  17.  
  18. ;; Modeline
  19. (setf *mode-line-foreground-color* "White")
  20. (setf *mode-line-background-color* "Black")
  21. (setf *mode-line-border-color* "Black")
  22. (setf *group-format* "%t")
  23. (setf *window-name-source* :title)
  24. (setf *window-format* "%c")
  25. (setf *screen-mode-line-format* (list " ^B^7*((^6*"
  26.                       '(:eval (run-shell-command "date '+%I:%M %p' |tr -d [:cntrl:]" t)) "^7*) (^6*%B^7*)"
  27.                                       " ^7*(^6*%g"
  28.                       " ^7*(^6*%w^7*)))"))
  29.  
  30. (if (not (head-mode-line (current-head)))
  31.     (toggle-mode-line (current-screen) (current-head)))
  32.  
  33. ;; Mouse and Fonts
  34. (run-shell-command "xsetroot -cursor_name left_ptr")
  35. (setf *mouse-focus-policy* :sloppy)
  36.  
  37. ;;Windows and Messages
  38. (defparameter *foreground-color* "White")
  39. (defparameter *background-color* "Black")
  40. (defparameter *border-color* "Dark Slate Gray")
  41.  
  42. (setf *message-window-gravity* :top-right)
  43. (setf *input-window-gravity* :top-right)
  44. (set-fg-color *foreground-color*)
  45. (set-bg-color *background-color*)
  46. (set-border-color *border-color*)
  47. (set-msg-border-width 0)
  48. (setf *window-border-style* :thin)
  49. (set-focus-color *foreground-color*)
  50. (set-unfocus-color *background-color*)
  51. (setf *normal-border-width* 0)
  52. (setf *maxsize-border-width* 0)
  53. (setf *transient-border-width* 0)
  54. (set-frame-outline-width 0)
  55.  
  56. ;;Groups
  57. (grename "1")
  58. (gnewbg "2")
  59. (gnewbg "3")
  60. (gnewbg "4")
  61.  
  62. ;; Prefix key
  63. (set-prefix-key (kbd "Menu"))
  64.  
  65. ;; -special keys
  66. (define-keysym #x1008ff95 "XF86WLAN")
  67. (define-keysym #x1008ff93 "XF86Battery")
  68. (define-keysym #x1008ff13 "XF86AudioRaiseVolume")
  69. (define-keysym #x1008ff11 "XF86AudioLowerVolume")
  70. (define-keysym #x1008ff12 "XF86AudioMute")
  71. (define-keysym #x1008ff02 "XF86MonBrightnessUp")
  72. (define-keysym #x1008ff03 "XF86MonBrightnessDown")
  73. (define-keysym #x1008ff2f "XF86Sleep")
  74.  
  75. ;; Commands
  76. (defcommand colon1 (&optional (initial "")) (:rest)
  77. "For use with interactive commands."
  78.   (let ((cmd (read-one-line (current-screen) ": " :initial-input initial)))
  79.     (when cmd
  80.       (eval-command cmd t))))
  81.  
  82. ;; -brightness
  83. (defcommand UpBrightness () ()
  84. "Turn up brightness"
  85.   (run-shell-command "exec xbacklight -set 100"))
  86.  
  87. (defcommand DownBrightness () ()
  88. "Turn down brightness"
  89.   (run-shell-command "exec xbacklight -set 50 -steps 1"))
  90.  
  91. (defcommand goodnight () () ;;for use with acpid/XF86Sleep
  92. "Display text"
  93.   (echo-string (current-screen)
  94.      "Good night!"))
  95.  
  96. (defcommand off () ()
  97. "Display text"
  98.   (echo-string (current-screen)
  99.      "Goodbye!")
  100.   (run-shell-command "exec sudo poweroff"))
  101.  
  102. (defcommand reboot () ()
  103. "Display text"
  104.   (echo-string (current-screen)
  105.      "See ya!")
  106.   (run-shell-command "exec sudo reboot"))
  107.  
  108. (defcommand snapshot () ()
  109. "Display text"
  110.   (echo-string (current-screen)
  111.      "Taking Snapshot")
  112.   (run-shell-command "exec scrot '%m.%d.%Y_%I:%M:%S_%P.png' -e 'mv $f ~/Images/snapshots'"))
  113.  
  114. (defparameter term "exec urxvt +sb -rv -bc -cr white -fn -*-terminus-*-*-*-*-12-*-*-*-*-*-*-*")
  115. (defparameter stumpish (concat term " -e /opt/stumpwm/contrib/stumpish"))
  116. (defparameter wicd (concat term " -e wicd-curses"))
  117.  
  118. (defcommand terminal () ()
  119. "Display text"
  120.   (run-shell-command term))
  121.  
  122. (defcommand stumpish-terminal () ()
  123. "Display text"
  124.   (run-shell-command stumpish))
  125.  
  126. (define-key *root-map* (kbd "c") "terminal")
  127. (define-key *root-map* (kbd "C-s") "stumpish-terminal")
  128. (define-key *root-map* (kbd "B") "reboot")
  129. (define-key *root-map* (kbd "P") "off")
  130. (define-key *root-map* (kbd "w") "exec conkeror")
  131. (define-key *top-map* (kbd "s-w") "exec conkeror")
  132. (define-key *top-map* (kbd "s-c") "terminal")
  133. (define-key *top-map* (kbd "s-e") "emacs")
  134. (define-key *top-map* (kbd "XF86WLAN") wicd)
  135. (define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer sset Master 5+")
  136. (define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer sset Master 5-")
  137. (define-key *top-map* (kbd "XF86AudioMute") "exec amixer sset Master toggle")
  138. (define-key *top-map* (kbd "XF86MonBrightnessUp") "UpBrightness")
  139. (define-key *top-map* (kbd "XF86MonBrightnessDown") "DownBrightness")
  140. (define-key *top-map* (kbd "XF86Sleep") "goodnight")
  141. (define-key *top-map* (kbd "Print") "snapshot")
  142.  
  143. ;; Menu
  144. (defparameter *app-menu* '(("Books"
  145.                             ;;submenu
  146.                             ("COMMON LISP: A Gentle Introduction to Symbolic Computation" "llpp /home/rich/Documents/book.pdf")
  147.                 ("The Linux Command Line" "llpp /home/rich/Documents/TLCL-09.12.pdf"))
  148.  
  149.                            ("Internet"
  150.                             ;; sub menu
  151.                             ("Conkeror" "conkeror")
  152.                             ("Elinks" "urxvt +sb -rv -bc -cr white -fn \"xft:DejaVu Sans Mono:pixelsize=12:\" -e elinks"))))
  153.  
  154. (define-key *root-map* (kbd ".") "mymenu")
  155.  
  156. (defcommand mymenu () ()
  157. "Display text"
  158.   (labels ((pick (options)
  159.              (let ((selection (stumpwm::select-from-menu (current-screen) options "")))
  160.                (cond
  161.                  ((null selection)
  162.                   (throw 'stumpwm::error "Okay."))
  163.                  ((stringp (second selection))
  164.                   (second selection))
  165.                  (t
  166.                   (pick (cdr selection)))))))
  167.     (let ((choice (pick *app-menu*)))
  168.       (run-shell-command choice))))
  169.  
  170. ;; Navigation
  171. ;; - swap windows
  172. (defun shift-windows-forward (frames win)
  173.   (when frames
  174.           (let ((frame (car frames)))
  175.                  (shift-windows-forward (cdr frames)
  176.                                         (frame-window frame))
  177.                  (when win
  178.                          (pull-window win frame)))))
  179.  
  180. (defcommand rotate-windows () ()
  181. "Display text"
  182.   (let* ((frames (group-frames (current-group)))
  183.            (win (frame-window (car (last frames)))))
  184.           (shift-windows-forward frames win)))
  185.  
  186. (defcommand other-win () ()
  187. "Display text"
  188.   (run-commands "other" "windows"))
  189.  
  190. (defcommand next-win () ()
  191. "Display text"
  192.   (run-commands "next" "windows"))
  193.  
  194. (defcommand prev-win () ()
  195. "Display text"
  196.   (run-commands "prev" "windows"))
  197.  
  198. ;(defcommand next-in-frame-win () ()
  199. ;  (run-commands "next-in-frame" (run-shell-command stumpwm:run-with-timer 1 () (run-shell-command "windows"))))
  200.  
  201. (defcommand prev-in-frame-win () ()
  202. "Display text"
  203.   (run-commands "prev-in-frame" "windows"))
  204.  
  205. ;; toggle between vertical split and horizontal split
  206. (defcommand toggle-split () ()
  207. "Display text"
  208.   (let* ((group (current-group))
  209.          (cur-frame (tile-group-current-frame group))
  210.          (frames (group-frames group)))
  211.     (if (eq (length frames) 2)
  212.         (progn (if (or (neighbour :left cur-frame frames)
  213.                        (neighbour :right cur-frame frames))
  214.                    (progn
  215.                      (only)
  216.                      (vsplit))
  217.                  (progn
  218.                    (only)
  219.                    (hsplit))))
  220.       (message "Works only with 2 frames"))))
  221.  
  222. (defparameter *layouts* (make-hash-table :test #'eql))
  223.  
  224. (defcommand toggle-full-layout () ()
  225.   (let* ( (gnum (group-number (current-group)))
  226.           (currlay (gethash gnum *layouts*)) )
  227.     (if currlay
  228.     (progn
  229.           (restore-group (current-group) currlay)
  230.           (setf (gethash gnum *layouts*) nil))
  231.       (progn
  232.         (setf (gethash gnum *layouts*) (dump-group (current-group)))
  233.     (run-commands "only"))
  234.       )
  235.     )  
  236.   )  
  237. (define-key *top-map* (kbd "s-q") "toggle-full-layout")
  238.  
  239. (define-key *top-map* (kbd "s-1") "gselect 1")
  240. (define-key *top-map* (kbd "s-2") "gselect 2")
  241. (define-key *top-map* (kbd "s-3") "gselect 3")
  242. (define-key *top-map* (kbd "s-4") "gselect 4")
  243. (define-key *top-map* (kbd "s-`") "rotate-windows")
  244. (define-key *top-map* (kbd "s-Tab") "other-win")
  245. (define-key *top-map* (kbd "M-Tab") "next-win")
  246. (define-key *top-map* (kbd "M-ISO_Left_Tab") "prev-win")
  247. (define-key *top-map* (kbd "s-SPC") "next-in-frame-win")
  248. (define-key *top-map* (kbd "S-s-SPC") "prev-in-frame-win")
  249. (define-key *top-map* (kbd "s-s") "vsplit")
  250. (define-key *top-map* (kbd "s-S") "hsplit")
  251. ;(define-key *top-map* (kbd "s-q") "only")
  252. (define-key *top-map* (kbd "s-k") "delete")
  253. (define-key *top-map* (kbd "s-K") "kill")
  254. (define-key *top-map* (kbd "s-~") "toggle-split")
  255.  
  256. ;; EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement