139 lines
4.5 KiB
Common Lisp
139 lines
4.5 KiB
Common Lisp
;;;;;; -*- mode: lisp -*-
|
|
|
|
(in-package :stumpwm)
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; 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"))
|
|
|
|
(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"
|
|
(run-shell-command "mpc next"))
|
|
|
|
(defcommand mpc-previous () ()
|
|
"Tell mpc to go to the previous song"
|
|
(run-shell-command "mpc prev"))
|
|
|
|
(defcommand mpc-volume (level) ((:string "Volume: "))
|
|
"Tell mpc to change the volume"
|
|
(run-shell-command (format nil "mpc volume ~a" level)))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Variables ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(defvar *my-program-bindings*
|
|
(let ((m (stumpwm:make-sparse-keymap)))
|
|
(stumpwm:define-key m (stumpwm:kbd "w") "luakit")
|
|
(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))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; General Settings ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(set-prefix-key (kbd "s-w"))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Mode-line ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(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 ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(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*)
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Hooks ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(add-hook *urgent-window-hook* 'echo-urgent-window)
|