summaryrefslogtreecommitdiffstats
path: root/.stumpwmrc
blob: c90eecb8aa45ccc6f38c8e5b2df2721a719d7f8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
;;;;;; -*- 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)