2011-05-01 17:08:18 +02:00
|
|
|
;;;;;; -*- mode: lisp -*-
|
|
|
|
|
|
|
|
(in-package :stumpwm)
|
|
|
|
|
2011-06-17 16:48:08 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Variables ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defvar *my-program-bindings*
|
|
|
|
(let ((m (stumpwm:make-sparse-keymap)))
|
|
|
|
(stumpwm:define-key m (stumpwm:kbd "M") "check-mail")
|
|
|
|
;; NOTE: this is important
|
|
|
|
m))
|
|
|
|
|
|
|
|
(defvar *my-mpc-bindings*
|
|
|
|
(let ((m (make-sparse-keymap)))
|
|
|
|
(define-key m (kbd "s") "mpc-playing")
|
|
|
|
(define-key m (kbd "S") "mpc-stop")
|
|
|
|
(define-key m (kbd "P") "mpc-toggle")
|
|
|
|
(define-key m (kbd "n") "mpc-next")
|
|
|
|
(define-key m (kbd "p") "mpc-previous")
|
|
|
|
(define-key m (kbd "v") "mpc-volume")
|
|
|
|
m))
|
|
|
|
|
|
|
|
(defvar *browser*
|
|
|
|
(getenv "BROWSER"))
|
|
|
|
|
2011-05-01 17:08:18 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Functions ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defun get-mail-count (mailbox)
|
|
|
|
"Check how many new messages there are for mailbox."
|
|
|
|
(length
|
|
|
|
(directory
|
|
|
|
(format nil "/home/slash/documents/mail/~A/INBOX/new/*.*" mailbox))))
|
|
|
|
|
|
|
|
(defun echo-urgent-window (target)
|
|
|
|
(message-no-timeout "~a has a message for you."
|
|
|
|
(window-title target)))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Commands ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(defcommand urxvt () ()
|
|
|
|
"run urxvt"
|
|
|
|
(run-shell-command "urxvt"))
|
|
|
|
|
2011-06-17 16:48:08 +02:00
|
|
|
(defcommand browser () ()
|
|
|
|
"open browser"
|
|
|
|
(run-shell-command *browser*))
|
|
|
|
|
2011-05-01 17:08:18 +02:00
|
|
|
(defcommand conkeror () ()
|
|
|
|
"run or raise conkeror"
|
|
|
|
(run-or-raise "conkeror" '(:class "Conkeror")))
|
|
|
|
|
|
|
|
(defcommand evolus-pencil () ()
|
|
|
|
"run evolus-pencil"
|
|
|
|
(run-shell-command "/usr/lib/evolus-pencil-svn/evolus-pencil.sh"))
|
|
|
|
|
|
|
|
(defcommand luakit () ()
|
|
|
|
"run luakit"
|
|
|
|
(run-shell-command "luakit"))
|
|
|
|
|
|
|
|
(defcommand check-mail () ()
|
|
|
|
"check new messages"
|
|
|
|
(run-shell-command "~/bin/mailrun.sh"))
|
|
|
|
|
|
|
|
(defcommand i3lock () ()
|
|
|
|
"run i3lock"
|
|
|
|
(run-shell-command "i3lock -c 000000"))
|
|
|
|
|
|
|
|
(defcommand mpc-playing () ()
|
|
|
|
"Show which song mpc is currently playing"
|
|
|
|
(message (run-shell-command "mpc | head -n1" t)))
|
|
|
|
|
|
|
|
(defcommand mpc-stop () ()
|
|
|
|
"Stop mpc from playing"
|
|
|
|
(run-shell-command "mpc stop"))
|
|
|
|
|
|
|
|
(defcommand mpc-toggle () ()
|
|
|
|
"Toggle mpc between playing and pauzed"
|
|
|
|
(run-shell-command "mpc toggle"))
|
|
|
|
|
|
|
|
(defcommand mpc-next () ()
|
|
|
|
"Tell mpc to go to the next song"
|
2011-06-17 16:48:08 +02:00
|
|
|
(message (run-shell-command "mpc next | head -n1" t)))
|
2011-05-01 17:08:18 +02:00
|
|
|
|
|
|
|
(defcommand mpc-previous () ()
|
|
|
|
"Tell mpc to go to the previous song"
|
2011-06-17 16:48:08 +02:00
|
|
|
(message (run-shell-command "mpc prev | head -n1" t)))
|
2011-05-01 17:08:18 +02:00
|
|
|
|
|
|
|
(defcommand mpc-volume (level) ((:string "Volume: "))
|
|
|
|
"Tell mpc to change the volume"
|
|
|
|
(run-shell-command (format nil "mpc volume ~a" level)))
|
|
|
|
|
2011-06-17 16:48:08 +02:00
|
|
|
(defcommand screenshot () ()
|
|
|
|
"Take a screenshot"
|
|
|
|
(run-shell-command "scrot"))
|
2011-05-01 17:08:18 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; General Settings ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(set-prefix-key (kbd "s-w"))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Mode-line ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2011-06-17 16:48:08 +02:00
|
|
|
(set-font "-*-dejavu sans-bold-r-*-*-13-*-*-*-*-*-iso8859-1")
|
|
|
|
|
2011-05-01 17:08:18 +02:00
|
|
|
(setf *mode-line-background-color* "Black")
|
|
|
|
(setf *mode-line-foreground-color* "White")
|
|
|
|
(setf *mode-line-timeout* 60)
|
|
|
|
|
|
|
|
;(setf *window-format* "%20t")
|
|
|
|
(setf *group-format* "[%n]")
|
|
|
|
|
|
|
|
(if (not (head-mode-line (current-head)))
|
|
|
|
(toggle-mode-line (current-screen) (current-head)))
|
|
|
|
(setf
|
|
|
|
stumpwm:*screen-mode-line-format*
|
|
|
|
(list
|
|
|
|
"%g | "
|
|
|
|
'(:eval (format
|
|
|
|
nil
|
|
|
|
"arch: ~D | gmail: ~D | aethon: ~D | updates: ~A | cower: ~A "
|
|
|
|
(get-mail-count "arch")
|
|
|
|
(get-mail-count "gmail")
|
|
|
|
(get-mail-count "aethon")
|
|
|
|
(run-shell-command
|
|
|
|
"echo -n `pacman -Qu | wc -l`" t)
|
|
|
|
(run-shell-command
|
|
|
|
"echo -n `cat ~/.cowercount`" t)))))
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Keybindings ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2011-06-17 16:48:08 +02:00
|
|
|
(define-key *root-map* (kbd "c") "urxvt")
|
|
|
|
(define-key *root-map* (kbd "s-l") "i3lock")
|
|
|
|
(define-key *root-map* (kbd "s-p") '*my-program-bindings*)
|
|
|
|
(define-key *root-map* (kbd "m") '*my-mpc-bindings*)
|
|
|
|
(define-key *root-map* (kbd "w") "browser")
|
|
|
|
(define-key *root-map* (kbd "SunPrint_Screen") "screenshot")
|
|
|
|
|
|
|
|
(define-key *top-map* (kbd "M-TAB") "next")
|
2011-05-01 17:08:18 +02:00
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; Hooks ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
(add-hook *urgent-window-hook* 'echo-urgent-window)
|