.stumpwmrc 0.7

; -*-lisp-*-

;;; 0.7

;; 2008/02/13

;; Replaced my MusicPD code with Patzy's as it's far more complete.

;; Using external 'unclutter' again.
;; (run-with-timer 5 5 'banish-pointer) became too annoying.

;; A few cleanups, mostly involving variable names.

(in-package :stumpwm)

;; Include Patzy's MPD code.
(load "~/.stumpwm/contrib/mpd.lisp")

;;; Internal variable definitions.

(defparameter *foreground-color* "darkcyan")
(defparameter *background-color* "black")
(defparameter *border-color* *foreground-color*)

(setf *format-time-string-default* "%a %b %e %k:%M")

(setf *mpd-port* 2100)
(setf *mpd-volume-step* 10)

;;; Internal function definitions.

;; Found at:
;; http://en.wikipedia.org/wiki/User:Gwern/.stumpwmrc
(defun cat (&rest strings) "A shortcut for (concatenate 'string foo bar)."
  (apply 'concatenate 'string strings))

;;; Theme.

;; Window border colors.
(set-focus-color *foreground-color*)
(set-unfocus-color *background-color*)

;; Input box colors.
(set-fg-color *foreground-color*)
(set-bg-color *background-color*)
(set-border-color *border-color*)

;; Modeline colors.
(setf *mode-line-foreground-color* *foreground-color*)
(setf *mode-line-background-color* *background-color*)
(setf *mode-line-border-color* *border-color*)

;; Background.
(run-shell-command (cat "xsetroot -solid " *background-color*))

;;; Init stuff.

;; Make frames and windows 1-indexed.
;; See: http://lists.gnu.org/archive/html/stumpwm-devel/2006-08/msg00002.html
;; Found at: http://en.wikipedia.org/wiki/User:Gwern/.stumpwmrc
(setf *frame-number-map* "1234567890")
(setf *window-number-map* "1234567890") ; This doesn't actually do anything.

;; Rename the first group to Browse and create the other groups.
;; Found at: http://en.wikipedia.org/wiki/User:Gwern/.stumpwmrc
(setf (group-name (first (screen-groups (current-screen)))) "Browse")
(run-commands "gnewbg Edit" "gnewbg Term" "gnewbg Comms" "gnewbg Misc")

;; Change the prefix key
;; keycode 115 = F20 in ~/.xmodmaprc, 115 being the left "windows" key.
(set-prefix-key (kbd "F20"))

;; Set up X cursor and colors.
(run-shell-command (cat "xsetroot -cursor_name left_ptr -fg " *background-color* ; Cursor body
                                                      " -bg " *border-color*)) ; Cursor outline

;; Keep the X cursor out of the way.
(run-shell-command "unclutter -idle 5 -jitter 5 -root")

;; Configure and start the modeline. Colors are handled above.
(setf *mode-line-border-width* 1)
(setf *mode-line-pad-x* 1)
(setf *mode-line-pad-y* 1)
(setf *mode-line-position* :bottom)
(setf *mode-line-timeout* 10) ; Update every 10 seconds if nothing else has triggered it already.
(setf *screen-mode-line-format* (list "((%n %w) (" ; Current group and frames
                                      `(:eval (format-time-string))
                                      ") (%m))")) ; Patzy's MPD code.

;; Switch mode-line on only if needed. Found at:
;; http://hcl-club.lu/svn/development/lisp/.stumpwmrc
(if (not (head-mode-line (current-head)))
     (toggle-mode-line (current-screen) (current-head)))

;; Found this tidbit browsing the source. Defaults to :ignore
(setf *mouse-focus-policy* :click) ; I'm fucking lame.

;;; Keyboard shortcuts.

;; Fluxbox-style Alt-F# virtual desktop (group in StumpWM-speak) switching. Modified from:
;; http://hcl-club.lu/svn/development/lisp/.stumpwmrc
(dotimes (i 13)
  (unless (eq i 0) ; F0 is non-existant and will error.
    (define-key *top-map* (kbd (format nil "M-F~a" i)) (format nil "gselect ~a" i))))

;; Applications.
(define-key *root-map* (kbd "b") "exec firefox ")
(define-key *root-map* (kbd "e") "exec xemacs ")
(define-key *root-map* (kbd "c") (cat "exec urxvt -fg " *foreground-color*
                                                " -bg " *background-color*
                                                " -pr " *foreground-color*
                                                " +sb "))

;; Audio controls, uses un-numlocked keypad.
;; Some keys duplicated, not sure which I prefer yet.
(define-key *top-map* (kbd "KP_Up")       "mpd-volume-up")
(define-key *top-map* (kbd "KP_Add")      "mpd-volume-up") ; Redundant
(define-key *top-map* (kbd "KP_Down")     "mpd-volume-down")
(define-key *top-map* (kbd "KP_Subtract") "mpd-volume-down") ; Redundant
(define-key *top-map* (kbd "KP_Left")     "mpd-prev")
(define-key *top-map* (kbd "KP_Right")    "mpd-next")
(define-key *top-map* (kbd "Num_Lock")    "mpd-toggle-pause") ; The light indicates play/pause ;)

February 13, 2008 - Posted by | Common Lisp, StumpWM

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: