Browse code
update stumpwm config
fiddlerwoaroof authored on 20/06/2017 07:01:52
Showing 7 changed files
Showing 7 changed files
- stumpwm.d/.gitignore
- stumpwm.d/build/.#commands.lisp
- stumpwm.d/build/build.lisp
- stumpwm.d/build/commands.lisp
- stumpwm.d/contrib
- stumpwm.d/modules/stumptray
- stumpwmrc
1 | 3 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+(in-package :cl-user) |
|
2 |
+ |
|
3 |
+(eval-when (:compile-toplevel :load-toplevel :execute) |
|
4 |
+ (load "~/quicklisp/setup.lisp") |
|
5 |
+ (ql:quickload :xembed) |
|
6 |
+ (ql:quickload :stumpwm) |
|
7 |
+ (ql:quickload :serapeum) |
|
8 |
+ (ql:quickload :clim-debugger) |
|
9 |
+ (ql:quickload :mpd-remote) |
|
10 |
+ (ql:quickload :ubiquitous) |
|
11 |
+ (ql:quickload :swank) |
|
12 |
+ (let ((*features* (cons :devtime *features*))) |
|
13 |
+ (compile-file "commands") |
|
14 |
+ (load "commands") |
|
15 |
+ (compile-file "~/.stumpwmrc") |
|
16 |
+ (load "~/.stumpwmrc")) |
|
17 |
+ |
|
18 |
+ (gc :full t)) |
|
19 |
+ |
|
20 |
+(defun toplevel () |
|
21 |
+ (let ((*debugger-hook* #'clim-debugger:debugger)) |
|
22 |
+ (stumpwm:stumpwm))) |
|
23 |
+ |
|
24 |
+(save-lisp-and-die (truename "~/bin/stumpwm") |
|
25 |
+ :executable t |
|
26 |
+ :toplevel #'toplevel |
|
27 |
+ :root-structures '(stumpwm:stumpwm) |
|
28 |
+ :compression t) |
0 | 29 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,151 @@ |
1 |
+(in-package :stumpwm) |
|
2 |
+(defvar *passwords* '()) |
|
3 |
+#+devtime |
|
4 |
+(progn |
|
5 |
+ (defcommand start-swank () () |
|
6 |
+ "Start a swank server on port 4587" |
|
7 |
+ (swank:create-server :port 4587 :dont-close t)) |
|
8 |
+ |
|
9 |
+ |
|
10 |
+ (defcommand pause-mpd () () |
|
11 |
+ "Pause MPD" |
|
12 |
+ (mpd-remote:with-mpd-connection (so st) |
|
13 |
+ (declare (ignorable so)) |
|
14 |
+ (mpd-remote:send-command st :pause))) |
|
15 |
+ |
|
16 |
+ (defcommand next-mpd () () |
|
17 |
+ "Next MPD" |
|
18 |
+ (mpd-remote:with-mpd-connection (so st) |
|
19 |
+ (declare (ignorable so)) |
|
20 |
+ (mpd-remote:send-command st :next) |
|
21 |
+ (current-song))) |
|
22 |
+ |
|
23 |
+ (defcommand prev-mpd () () |
|
24 |
+ "Prev MPD" |
|
25 |
+ (mpd-remote:with-mpd-connection (so st) |
|
26 |
+ (declare (ignorable so)) |
|
27 |
+ (mpd-remote:send-command st :previous) |
|
28 |
+ (current-song))) |
|
29 |
+ |
|
30 |
+ (defcommand current-song () () |
|
31 |
+ "Display information about the current song" |
|
32 |
+ (mpd-remote:with-mpd-connection (so st) |
|
33 |
+ (declare (ignorable so)) |
|
34 |
+ (let ((current-song (mpd-remote:send-command st :current-song))) |
|
35 |
+ (message "~a ~a: ~a - ~a" |
|
36 |
+ (mpd-remote.song::track current-song) |
|
37 |
+ (mpd-remote.song::artist current-song) |
|
38 |
+ (mpd-remote.song::album current-song) |
|
39 |
+ (mpd-remote.song::title current-song))))) |
|
40 |
+ |
|
41 |
+ (defparameter *browser-command* "/usr/bin/google-chrome-beta") |
|
42 |
+ |
|
43 |
+ (defun cat (&rest strings) |
|
44 |
+ (uiop:escape-sh-command strings)) |
|
45 |
+ |
|
46 |
+ (defgeneric get-search-url (provider &rest strings) |
|
47 |
+ (:method-combination append :most-specific-last) |
|
48 |
+ (:method :around (provider &rest r) |
|
49 |
+ (declare (ignore r)) |
|
50 |
+ (apply #'concatenate 'string (call-next-method))) |
|
51 |
+ |
|
52 |
+ (:method append (provider &rest r) |
|
53 |
+ (declare (ignore r)) |
|
54 |
+ (list "https://duckduckgo.com/?q=")) |
|
55 |
+ (:method append ((provider (eql nil)) &rest strings) |
|
56 |
+ (list* (car strings) (loop for string in (cdr strings) nconcing (list "+" string)))) |
|
57 |
+ |
|
58 |
+ (:method append ((provider (eql :google)) &rest strings) |
|
59 |
+ (list* "%21google" (loop for string in strings nconcing (list "+" string))))) |
|
60 |
+ |
|
61 |
+ (defmacro add-provider (name ddg-shortcut) |
|
62 |
+ `(defmethod get-search-url append ((provider (eql ,name)) &rest strings) |
|
63 |
+ (list* (concatenate 'string "%21" ,ddg-shortcut) |
|
64 |
+ (loop for string in strings nconcing (list "+" string))))) |
|
65 |
+ |
|
66 |
+ (defmacro add-providers (&body definitions) |
|
67 |
+ `(progn |
|
68 |
+ ,@(loop for (name shortcut) in definitions |
|
69 |
+ collect `(add-provider ,name ,shortcut)))) |
|
70 |
+ |
|
71 |
+ |
|
72 |
+ (add-providers |
|
73 |
+ (:amazon "a") |
|
74 |
+ (:php "php") |
|
75 |
+ (:python "python") |
|
76 |
+ (:stack-overflow "sof") |
|
77 |
+ (:lisp "lisp") |
|
78 |
+ (:wikipedia "w")) |
|
79 |
+ |
|
80 |
+ (defcommand slack-copy () () |
|
81 |
+ (ubiquitous:restore :atomampd-slack) |
|
82 |
+ (push (get-x-selection) (ubiquitous:value :clip)) |
|
83 |
+ (ubiquitous:offload)) |
|
84 |
+ |
|
85 |
+ (defcommand google (provider search-string) ((:string "Search Provider? ") (:string "Search Google for: ")) |
|
86 |
+ "Search google for a given string" |
|
87 |
+ (check-type search-string (or null string)) |
|
88 |
+ (when search-string) |
|
89 |
+ (run-shell-command (cat *browser-command* " " |
|
90 |
+ (get-search-url :google (substitute #\+ #\space search-string))))) |
|
91 |
+ |
|
92 |
+ |
|
93 |
+ (defcommand do-search (provider search-string) ((:string "Provider: ") (:string "Search for: ")) |
|
94 |
+ "Run a search against a specified provider" |
|
95 |
+ (check-type provider (or null string)) |
|
96 |
+ (check-type search-string (or null string)) |
|
97 |
+ (when (and provider search-string) |
|
98 |
+ (let ((provider (intern (string-upcase provider) :keyword))) |
|
99 |
+ (run-shell-command (cat *browser-command* " " |
|
100 |
+ (get-search-url provider (substitute #\+ #\space search-string))))))) |
|
101 |
+ |
|
102 |
+ (defcommand google (search-string) ((:string "Search Google for: ")) |
|
103 |
+ "Search google for a given string" |
|
104 |
+ (check-type search-string (or null string)) |
|
105 |
+ (when search-string |
|
106 |
+ (run-shell-command (cat *browser-command* " " |
|
107 |
+ (get-search-url :google (substitute #\+ #\space search-string)))))) |
|
108 |
+ |
|
109 |
+ (defcommand duckduckgo (search-string) ((:string "Search DDG for: ")) |
|
110 |
+ "Search duckduckgo gor a given string" |
|
111 |
+ (check-type search-string (or null string)) |
|
112 |
+ (when search-string |
|
113 |
+ (run-shell-command (cat *browser-command* " " |
|
114 |
+ (get-search-url nil (substitute #\+ #\space search-string)))))) |
|
115 |
+ |
|
116 |
+ (defcommand search-for-selection (provider) ((:string "Search Provider?")) |
|
117 |
+ "Search for the x selection with provider" |
|
118 |
+ (do-search provider (get-x-selection))) |
|
119 |
+ |
|
120 |
+ (defcommand jira-ticket (number) ((:string "Ticket Number? ")) |
|
121 |
+ "get moi a jira ticket" |
|
122 |
+ (unless (alpha-char-p (elt number 0)) |
|
123 |
+ (setf number (format nil "ATOMOS-~a" number))) |
|
124 |
+ (run-shell-command #1=(cat *browser-command* |
|
125 |
+ (format nil "https://atomampd.atlassian.net/browse/~a" number)))) |
|
126 |
+ |
|
127 |
+ (defcommand run-yeganesh () () |
|
128 |
+ "Run Command given by yeganesh" |
|
129 |
+ (let ((cmd (run-shell-command "/home/edwlan/bin/yeganesh_run" t))) |
|
130 |
+ (run-shell-command cmd))) |
|
131 |
+ |
|
132 |
+ (defcommand put-password (identifier) ((:string "Password Identifier? ")) |
|
133 |
+ "Put a password into a text-input" |
|
134 |
+ (window-send-string (cdr (assoc (alexandria:make-keyword (string-upcase identifier)) |
|
135 |
+ *passwords*)))) |
|
136 |
+ (defcommand store-password (identifier password) ((:string "Password Identifier? ") (:string "Password? ")) |
|
137 |
+ "Store a password..." |
|
138 |
+ (setf *passwords* (acons (alexandria:make-keyword (string-upcase identifier)) |
|
139 |
+ password |
|
140 |
+ *passwords*)) |
|
141 |
+ "stored") |
|
142 |
+ |
|
143 |
+ (defcommand reap-zombies () () |
|
144 |
+ (message "~s" |
|
145 |
+ (loop with reaped-pids = '() |
|
146 |
+ for pid = (sb-posix:waitpid -1 sb-posix:WNOHANG) |
|
147 |
+ until (= pid 0) |
|
148 |
+ do (push pid reaped-pids) |
|
149 |
+ finally (return reaped-pids))))) |
|
150 |
+ |
|
151 |
+ ;(defi) |
... | ... |
@@ -1,190 +1,51 @@ |
1 | 1 |
(in-package :stumpwm) |
2 |
+(defvar *selection-search-map* nil "selection search map") |
|
3 |
+(defvar *search-map* nil "search map") |
|
2 | 4 |
|
5 |
+#+devtime |
|
6 |
+(progn |
|
7 |
+ (setf *window-format* "%s%m%n: %15t") |
|
8 |
+ (setf *window-format-by-class* "%m%n %c %s%92t")) |
|
3 | 9 |
|
4 |
-(load-module "stumptray") |
|
5 |
-(mode-line) |
|
6 |
-(stumptray:stumptray) |
|
7 |
-(setf *window-format* "%s%m%n: %15t") |
|
8 |
-(setf *window-format-by-class* "%m%n %c %s%92t") |
|
9 |
- |
|
10 |
+#-devtime |
|
10 | 11 |
(eval-when (:load-toplevel :compile-toplevel :execute) |
11 |
- (set-prefix-key (kbd "s-space")) |
|
12 |
- (load "~/quicklisp/setup.lisp") |
|
13 |
- (ql:quickload :mpd-remote) |
|
14 |
- (ql:quickload :ubiquitous) |
|
15 |
- (ql:quickload :swank)) |
|
16 |
- |
|
17 |
-(defcommand start-swank () () |
|
18 |
- "Start a swank server on port 4587" |
|
19 |
- (swank:create-server :port 4587 :dont-close nil)) |
|
20 |
- |
|
21 |
- |
|
22 |
-(defcommand pause-mpd () () |
|
23 |
- "Pause MPD" |
|
24 |
- (mpd-remote:with-mpd-connection (so st) |
|
25 |
- (declare (ignorable so)) |
|
26 |
- (mpd-remote:send-command st :pause))) |
|
27 |
- |
|
28 |
-(defcommand next-mpd () () |
|
29 |
- "Next MPD" |
|
30 |
- (mpd-remote:with-mpd-connection (so st) |
|
31 |
- (declare (ignorable so)) |
|
32 |
- (mpd-remote:send-command st :next) |
|
33 |
- (current-song))) |
|
34 |
- |
|
35 |
-(defcommand prev-mpd () () |
|
36 |
- "Prev MPD" |
|
37 |
- (mpd-remote:with-mpd-connection (so st) |
|
38 |
- (declare (ignorable so)) |
|
39 |
- (mpd-remote:send-command st :previous) |
|
40 |
- (current-song))) |
|
41 |
- |
|
42 |
-(defcommand current-song () () |
|
43 |
- "Display information about the current song" |
|
44 |
- (mpd-remote:with-mpd-connection (so st) |
|
45 |
- (declare (ignorable so)) |
|
46 |
- (let ((current-song (mpd-remote:send-command st :current-song))) |
|
47 |
- (message "~a ~a: ~a - ~a" |
|
48 |
- (mpd-remote.song::track current-song) |
|
49 |
- (mpd-remote.song::artist current-song) |
|
50 |
- (mpd-remote.song::album current-song) |
|
51 |
- (mpd-remote.song::title current-song))))) |
|
52 |
- |
|
53 |
-(defparameter *browser-command* "/usr/bin/google-chrome-beta") |
|
54 |
- |
|
55 |
-(defun cat (&rest strings) |
|
56 |
- (uiop:escape-sh-command strings)) |
|
57 |
- |
|
58 |
-(defgeneric get-search-url (provider &rest strings) |
|
59 |
- (:method-combination append :most-specific-last) |
|
60 |
- (:method :around (provider &rest r) |
|
61 |
- (declare (ignore r)) |
|
62 |
- (apply #'concatenate 'string (call-next-method))) |
|
63 |
- |
|
64 |
- (:method append (provider &rest r) |
|
65 |
- (declare (ignore r)) |
|
66 |
- (list "https://duckduckgo.com/?q=")) |
|
67 |
- (:method append ((provider (eql nil)) &rest strings) |
|
68 |
- (list* (car strings) (loop for string in (cdr strings) nconcing (list "+" string)))) |
|
69 |
- |
|
70 |
- (:method append ((provider (eql :google)) &rest strings) |
|
71 |
- (list* "%21google" (loop for string in strings nconcing (list "+" string))))) |
|
72 |
- |
|
73 |
-(defmacro add-provider (name ddg-shortcut) |
|
74 |
- `(defmethod get-search-url append ((provider (eql ,name)) &rest strings) |
|
75 |
- (list* (concatenate 'string "%21" ,ddg-shortcut) |
|
76 |
- (loop for string in strings nconcing (list "+" string))))) |
|
77 |
- |
|
78 |
-(defmacro add-providers (&body definitions) |
|
79 |
- `(progn |
|
80 |
- ,@(loop for (name shortcut) in definitions |
|
81 |
- collect `(add-provider ,name ,shortcut)))) |
|
82 |
- |
|
83 |
- |
|
84 |
-(add-providers |
|
85 |
- (:amazon "a") |
|
86 |
- (:php "php") |
|
87 |
- (:python "python") |
|
88 |
- (:stack-overflow "sof") |
|
89 |
- (:lisp "lisp") |
|
90 |
- (:wikipedia "w")) |
|
12 |
+ (load-module "stumptray")) |
|
91 | 13 |
|
92 |
-(defcommand slack-copy () () |
|
93 |
- (ubiquitous:restore :atomampd-slack) |
|
94 |
- (push (get-x-selection) (ubiquitous:value :clip)) |
|
95 |
- (ubiquitous:offload)) |
|
96 |
- |
|
97 |
-(defcommand google (provider search-string) ((:string "Search Provider? ") (:string "Search Google for: ")) |
|
98 |
- "Search google for a given string" |
|
99 |
- (check-type search-string (or null string)) |
|
100 |
- (when search-string) |
|
101 |
- (run-shell-command (cat *browser-command* " " |
|
102 |
- (get-search-url :google (substitute #\+ #\space search-string))))) |
|
103 |
- |
|
104 |
- |
|
105 |
-(defcommand do-search (provider search-string) ((:string "Provider: ") (:string "Search for: ")) |
|
106 |
- "Run a search against a specified provider" |
|
107 |
- (check-type provider (or null string)) |
|
108 |
- (check-type search-string (or null string)) |
|
109 |
- (when (and provider search-string) |
|
110 |
- (let ((provider (intern (string-upcase provider) :keyword))) |
|
111 |
- (run-shell-command (cat *browser-command* " " |
|
112 |
- (get-search-url provider (substitute #\+ #\space search-string))))))) |
|
113 |
- |
|
114 |
-(defcommand google (search-string) ((:string "Search Google for: ")) |
|
115 |
- "Search google for a given string" |
|
116 |
- (check-type search-string (or null string)) |
|
117 |
- (when search-string |
|
118 |
- (run-shell-command (cat *browser-command* " " |
|
119 |
- (get-search-url :google (substitute #\+ #\space search-string)))))) |
|
120 |
- |
|
121 |
-(defcommand duckduckgo (search-string) ((:string "Search DDG for: ")) |
|
122 |
- "Search duckduckgo gor a given string" |
|
123 |
- (check-type search-string (or null string)) |
|
124 |
- (when search-string |
|
125 |
- (run-shell-command (cat *browser-command* " " |
|
126 |
- (get-search-url nil (substitute #\+ #\space search-string)))))) |
|
127 |
- |
|
128 |
-(defcommand search-for-selection (provider) ((:string "Search Provider?")) |
|
129 |
- "Search for the x selection with provider" |
|
130 |
- (do-search provider (get-x-selection))) |
|
131 |
- |
|
132 |
-(defcommand jira-ticket (number) ((:string "Ticket Number? ")) |
|
133 |
- "get moi a jira ticket" |
|
134 |
- (unless (alpha-char-p (elt number 0)) |
|
135 |
- (setf number (format nil "ATOMOS-~a" number))) |
|
136 |
- (run-shell-command #1=(cat *browser-command* |
|
137 |
- (format nil "https://atomampd.atlassian.net/browse/~a" number)))) |
|
138 |
- |
|
139 |
-(defparameter *selection-search-map* nil "selection search map") |
|
140 |
-(fill-keymap *selection-search-map* |
|
141 |
- (kbd "g") "search-for-selection google" |
|
142 |
- (kbd "/") "search-for-selection google" |
|
143 |
- (kbd "s-/") "search-for-selection google" |
|
144 |
- (kbd "l") "search-for-selection lisp") |
|
145 |
- |
|
146 |
-(defparameter *search-map* nil "search map") |
|
147 |
-(fill-keymap *search-map* |
|
148 |
- (kbd "a") "do-search amazon" |
|
149 |
- (kbd "h") "do-search php" |
|
150 |
- (kbd "p") "do-search python" |
|
151 |
- (kbd "o") "do-search stack-overflow" |
|
152 |
- (kbd "y") "do-search youtube" |
|
153 |
- (kbd "l") "do-search lisp" |
|
154 |
- (kbd "w") "do-search wikipedia" |
|
155 |
- (kbd "d") "do-search duckduckgo" |
|
156 |
- (kbd "g") "do-search google" |
|
157 |
- (kbd "s") *selection-search-map* |
|
158 |
- (kbd "/") "do-search google" |
|
159 |
- (kbd "Return") "search-for-selection google" |
|
160 |
- (kbd "s-/") "do-search google") |
|
161 |
- |
|
162 |
-(defcommand run-yeganesh () () |
|
163 |
- "Run Command given by yeganesh" |
|
164 |
- (let ((cmd (run-shell-command "/home/edwlan/bin/yeganesh_run" t))) |
|
165 |
- (run-shell-command cmd))) |
|
166 |
- |
|
167 |
-(define-key *top-map* (kbd "s-!") "run-yeganesh") |
|
168 |
-(define-key *top-map* (kbd "s-/") *search-map*) |
|
169 |
-(define-key *top-map* (kbd "s-TAB") "fnext") |
|
170 |
-(define-key *top-map* (kbd "s-ISO_Left_Tab") "fother") |
|
171 |
- |
|
172 |
-(define-key *root-map* (kbd "\"") "windowlist-by-class") |
|
173 |
-(define-key *root-map* (kbd "n") "next-in-frame") |
|
174 |
-(define-key *root-map* (kbd "p") "prev-in-frame") |
|
175 |
- |
|
176 |
-(defparameter *passwords* '()) |
|
177 |
-(defcommand put-password (identifier) ((:string "Password Identifier? ")) |
|
178 |
- "Put a password into a text-input" |
|
179 |
- (window-send-string (cdr (assoc (alexandria:make-keyword (string-upcase identifier)) |
|
180 |
- *passwords*)))) |
|
181 |
-(defcommand store-password (identifier password) ((:string "Password Identifier? ") (:string "Password? ")) |
|
182 |
- "Store a password..." |
|
183 |
- (setf *passwords* (acons (alexandria:make-keyword (string-upcase identifier)) |
|
184 |
- password |
|
185 |
- *passwords*)) |
|
186 |
- "stored") |
|
187 |
- |
|
188 |
-;(defi) |
|
189 |
- |
|
190 |
-; vim: set ft=lisp: |
|
14 |
+(eval-when (:load-toplevel :compile-toplevel :execute) |
|
15 |
+ #-devtime |
|
16 |
+ (progn |
|
17 |
+ (set-prefix-key (kbd "s-space")) |
|
18 |
+ (mode-line) |
|
19 |
+ (stumptray:stumptray) |
|
20 |
+ |
|
21 |
+ (fill-keymap *selection-search-map* |
|
22 |
+ (kbd "g") "search-for-selection google" |
|
23 |
+ (kbd "/") "search-for-selection google" |
|
24 |
+ (kbd "s-/") "search-for-selection google" |
|
25 |
+ (kbd "l") "search-for-selection lisp") |
|
26 |
+ |
|
27 |
+ (fill-keymap *search-map* |
|
28 |
+ (kbd "a") "do-search amazon" |
|
29 |
+ (kbd "h") "do-search php" |
|
30 |
+ (kbd "p") "do-search python" |
|
31 |
+ (kbd "o") "do-search stack-overflow" |
|
32 |
+ (kbd "y") "do-search youtube" |
|
33 |
+ (kbd "l") "do-search lisp" |
|
34 |
+ (kbd "w") "do-search wikipedia" |
|
35 |
+ (kbd "d") "do-search duckduckgo" |
|
36 |
+ (kbd "g") "do-search google" |
|
37 |
+ (kbd "s") *selection-search-map* |
|
38 |
+ (kbd "/") "do-search google" |
|
39 |
+ (kbd "Return") "search-for-selection google" |
|
40 |
+ (kbd "s-/") "do-search google") |
|
41 |
+ |
|
42 |
+ (define-key *top-map* (kbd "s-!") "run-yeganesh") |
|
43 |
+ (define-key *top-map* (kbd "s-/") *search-map*) |
|
44 |
+ (define-key *top-map* (kbd "s-TAB") "fnext") |
|
45 |
+ (define-key *top-map* (kbd "s-ISO_Left_Tab") "fother") |
|
46 |
+ |
|
47 |
+ (define-key *root-map* (kbd "\"") "windowlist-by-class") |
|
48 |
+ (define-key *root-map* (kbd "n") "next-in-frame") |
|
49 |
+ (define-key *root-map* (kbd "p") "prev-in-frame")) ) |
|
50 |
+ |
|
51 |
+;;; vim: set ft=lisp: |