From ba0360b73e65391d5cccdb6ba1f3731d80a0b47f Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Fri, 17 Jun 2011 16:48:08 +0200 Subject: [PATCH] STUMPWM: Keybinds, mpc, browser, screenshot, font * 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". --- stumpwmrc | 68 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 26 deletions(-) diff --git a/stumpwmrc b/stumpwmrc index f4c9cef..c90eecb 100644 --- a/stumpwmrc +++ b/stumpwmrc @@ -2,6 +2,29 @@ (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 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -24,6 +47,10 @@ "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"))) @@ -58,36 +85,19 @@ (defcommand mpc-next () () "Tell mpc to go to the next song" - (run-shell-command "mpc next")) + (message (run-shell-command "mpc next | head -n1" t))) (defcommand mpc-previous () () "Tell mpc to go to the previous song" - (run-shell-command "mpc prev")) + (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))) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; 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)) +(defcommand screenshot () () + "Take a screenshot" + (run-shell-command "scrot")) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; General Settings ;; @@ -99,6 +109,8 @@ ;; 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) @@ -127,10 +139,14 @@ ;; 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 "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 ;;