ba0360b73e
* Added variable *browser* which reads the environment variable $BROWSER. * Added command browser which starts *browser*. * The MPC next and prev commands now show which songs they skip to. * Added command screenshot, which takes a screenshot with scrot. * Set font to DejaVu Sans, bold, 13. * Added browser keybinding, screenshot and "next".
155 lines
4.9 KiB
Common Lisp
155 lines
4.9 KiB
Common Lisp
;;;;;; -*- mode: lisp -*-
|
|
|
|
(in-package :stumpwm)
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; 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"))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; 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 browser () ()
|
|
"open browser"
|
|
(run-shell-command *browser*))
|
|
|
|
(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"
|
|
(message (run-shell-command "mpc next | head -n1" t)))
|
|
|
|
(defcommand mpc-previous () ()
|
|
"Tell mpc to go to the previous song"
|
|
(message (run-shell-command "mpc prev | head -n1" t)))
|
|
|
|
(defcommand mpc-volume (level) ((:string "Volume: "))
|
|
"Tell mpc to change the volume"
|
|
(run-shell-command (format nil "mpc volume ~a" level)))
|
|
|
|
(defcommand screenshot () ()
|
|
"Take a screenshot"
|
|
(run-shell-command "scrot"))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; General Settings ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(set-prefix-key (kbd "s-w"))
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Mode-line ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(set-font "-*-dejavu sans-bold-r-*-*-13-*-*-*-*-*-iso8859-1")
|
|
|
|
(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*)
|
|
(define-key *root-map* (kbd "w") "browser")
|
|
(define-key *root-map* (kbd "SunPrint_Screen") "screenshot")
|
|
|
|
(define-key *top-map* (kbd "M-TAB") "next")
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
;; Hooks ;;
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
(add-hook *urgent-window-hook* 'echo-urgent-window)
|