Created
May 2, 2012 14:38
-
-
Save priyadarshan/2577020 to your computer and use it in GitHub Desktop.
.stumpwmrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;; -*- Mode: Lisp -*- | |
;;;; http://pastebin.com/S1FzEZpn | |
;; | |
;; vim: filetype=lisp | |
(in-package :stumpwm) | |
;; Load swank. | |
;; ! what's this? | |
(load "/opt/quicklisp/dists/quicklisp/software/slime-20120307-cvs/swank-loader.lisp") | |
(swank-loader:init) | |
(defcommand swank () () | |
(setf stumpwm:*top-level-error-action* :break) | |
(swank:create-server :port 4005 | |
:style swank:*communication-style* | |
:dont-close t) | |
(echo-string (current-screen) | |
"Starting swank. M-x slime-connect RET RET, then (in-package stumpwm).")) | |
;(swank) | |
;; 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) | |
;(set-font "-lispm-*-*-*-*-*-*-*-*-*-*-*-*-*") | |
;(set-font "-misc-fixed-bold-r-normal-*-18-*-*-*-*-*-*-*") | |
;(set-font "-adobe-helvetica-medium-r-*-*-11-*-*-*-*-*-*-*") | |
(set-font "-*-terminus-*-*-*-*-12-*-*-*-*-*-*-*") | |
;;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 #0x1008ff95 "XF86WLAN") | |
(define-keysym #0x1008ff93 "XF86Battery") | |
(define-keysym #0x1008ff13 "XF86AudioRaiseVolume") | |
(define-keysym #0x1008ff11 "XF86AudioLowerVolume") | |
(define-keysym #0x1008ff12 "XF86AudioMute") | |
(define-keysym #0x1008ff02 "XF86MonBrightnessUp") | |
(define-keysym #0x1008ff03 "XF86MonBrightnessDown") | |
(define-keysym #0x1008ff2f "XF86Sleep") | |
;; Commands | |
;; - interactive commands | |
(defcommand colon1 (&optional (initial "")) (:rest) | |
(let ((cmd (read-one-line (current-screen) ": " :initial-input initial))) | |
(when cmd | |
(eval-command cmd t)))) | |
;; -brightness | |
(defcommand UpBrightness () () | |
(run-shell-command "exec xbacklight -set 100")) | |
(defcommand DownBrightness () () | |
(run-shell-command "exec xbacklight -set 50 -steps 1")) | |
(defcommand goodnight () () ;;for use with acpid/XF86Sleep | |
(echo-string (current-screen) | |
"Good night!")) | |
(defcommand off () () | |
(echo-string (current-screen) | |
"Goodbye!") | |
(run-shell-command "exec sudo poweroff")) | |
(defcommand reboot () () | |
(echo-string (current-screen) | |
"See ya!") | |
(run-shell-command "exec sudo reboot")) | |
(defcommand snapshot () () | |
(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 () () | |
(run-shell-command term)) | |
(defcommand stumpish-terminal () () | |
(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 () () | |
(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 () () | |
(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 () () | |
(run-commands "next" "windows")) | |
(defcommand prev-win () () | |
(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")))) | |
(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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment