-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstumpwmrc
683 lines (532 loc) · 23.9 KB
/
stumpwmrc
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
;; -*- common-lisp -*-
;; (ql:update-all-dists)
;; (defun mywm ()
;; (run-commands "grename F1")
;; (restore-from-file "~/bin/stump/my.desktop")
;; (run-commands "gselect 1")
;; (restore-window-placement-rules "~/bin/stump/my.windows")
;; (define-frame-preference "F1"
;; ;; frame raise lock (lock AND raise == jumpto)
;; (0 t t :class "Totem")
;; (1 t t :class "Firefox")
;; (2 t t :title "emacs"))
;; (run-commands "exec totem" "emacs" "exec firefox"))
;; to export an system wide env. without having to restart stumpwm/x-win:
;; (SB-POSIX:SETENV "FOO" "bar" 0) ;; note, uses C, so true/false is 1/0
;; Much stolen from:
;; http://stumpwm.svkt.org/cgi-bin/wiki.pl/batman.stumpwmrc
;; http://exal.0x2.org/conf/stumpwmrc.html
;; http://code.google.com/p/deftsp-dotfiles/source/browse/trunk/.stumpwmrc
;;
;; <http:en.wikipedia.org/wiki/User:Gwern/.stumpwmrc>
;; Other configs:
;; http://aperturefever.wordpress.com/2010/05/10/updating-stumpwm-conf/
;; https://raw.github.com/milomouse/dotfiles/e35205081063912e4f1adf49d1986ef688f9dbf9/.stumpwmrc
;; http://www.mygooglest.com/fni/stumpwm.html
;; Useful functions:
;; info
;; describe-variable
;; describe-function
;; describe-key
;; where-is
;; TODO: floating vs. banish mouse. pipa conky.
;; TODO: kolla upp set-transient-gravity. reglerar var små rutor/popup-dialoger hamnar.
;; hur ersätter jag C-M-pil (gnext/gprev) och s-pil (next frame/previous frame)
;; läser manualen nu: C-< -, C-< #, C-< h m, C-< h c,
;; hur ändrar jag storlek på fönster i gnew-float? höger-mus på kanten.
;; change color of help-text / message text?
;; defun = ej user visible, annars använd defcommand (har ersatt define-stumpwm-command)
;; FIND ERRORS: Compile the config file using sbcl:
;; (ql:quickload :stumpwm)
;; (compile-file ".stumpwmrc")
(in-package :stumpwm)
(message "Loading stumpwmrc..")
;;(run-shell-command "rm $HOME/.xsession-errors")
;; don't show which window is active when switching groupes:
;;(setf *suppress-frame-indicator* t)
;;;; TEST ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;Query ACPI and show the battery's status.
(defcommand show-battery () ()
"Show battery information battery."
(echo-string (current-screen) (run-shell-command "acpi" t)))
;;;; Color Theme ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defparameter FOREGROUND-COLOR "snow3")
(defparameter BACKGROUND-COLOR "grey20")
(defparameter BORDER-COLOR "snow3")
(defparameter BORDER-WIDTH 1)
;;just used in dmenu for now
(defparameter SELECT-BG-COLOR "snow3")
(defparameter SELECT-FG-COLOR "grey20")
;; for native stumpwm
;;(defparameter FONT "-lispm-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*")
;;(defparameter FONT "-xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-15")
(defparameter FONT "-*-terminus-*-r-*-*-12-120-72-72-c-*-iso8859-*")
;; for external programs dmenu/clipmenu
(defparameter FONT2 "Terminus:size=10")
;;different set up for home computer and work computer
(defvar AT_HOME t)
(if (probe-file "/etc/SuSE-release")
(setf AT_HOME nil)
(setf AT_HOME t))
;;;; Functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; from http://en.wikipedia.org/wiki/User:Gwern/.stumpwmrc
(defun cat (&rest strings) "A shortcut for (concatenate 'string foo bar)."
(apply 'concatenate 'string strings))
;; https://tools.suckless.org/dmenu/
(defcommand dmenu () ()
"Make dmenu use color from theme variables"
(run-shell-command (cat "dmenu_run -nf " FOREGROUND-COLOR
" -nb " BACKGROUND-COLOR
" -sb " SELECT-BG-COLOR
" -sf " SELECT-FG-COLOR
" -fn \""FONT2"\"")))
;; https://github.com/cdown/clipmenu
;; use: systemctl --user enable clipmenud.service
(defcommand clipmenu () ()
"Make clipmenu use color from theme variables, (identical to dmenu)"
(run-shell-command (cat "clipmenu -nf " FOREGROUND-COLOR
" -nb " BACKGROUND-COLOR
" -sb " SELECT-BG-COLOR
" -sf " SELECT-FG-COLOR
" -fn \""FONT2"\"")))
(defcommand conkeror () ()
"Use conkeror as browser"
(run-or-raise "exec conkeror -P default" '(:title "Conkeror default")))
(defcommand lock-screen () ()
"Lock screen using slock"
(run-shell-command "slock"))
;;XXX use urxvt-daemon instead of normal urxvt.
(defcommand term () ()
"Use urxvt as terminal."
(run-shell-command "urxvtcd" '(:instance "urxvt")))
(defcommand tmux () ()
"Start a tmux session in urxvt"
(run-or-raise "urxvt -e tmux" '(:instance "tmux")))
(defcommand emacs () () ;! redefining emacs command
"Start emacs server if not running, elese connect to it."
(run-or-raise "emacsclient -c -a \"\"" '(:instance "emacs")))
(defcommand pdf-veiwer () ()
"How to view pdf-files."
(run-or-raise "xpdf" '(:class "pdf")))
;; redefine run-shell-command for 'zsh', change :shell "", and fix a typo.
;;affects the "exec" command, bound to "C-t !" (if C-t is prefix key).
(defcommand run-shell-command (cmd &optional collect-output-p)
((:shell "execute: "))
"Run the specified shell command. If @var{collect-output-p} is @code{T}
then run the command synchronously and collect the output."
(if collect-output-p
(run-prog-collect-output *shell-program* "-c" cmd)
(run-prog *shell-program* :args (list "-c" cmd) :wait nil)))
(setf *shell-program* (stumpwm::getenv "SHELL"))
(defcommand-alias exec run-shell-command)
(defcommand power-down () ()
"Shut down computer."
(run-shell-command "systemctl poweroff"))
(defcommand screenshot-select () ()
"Take a screenshot of only the active window."
(run-shell-command "scrot -s"))
(defcommand screenshot-delay () ()
"Take a screenshot with two seconds delay."
(run-shell-command "scrot -d 2"))
(defcommand paste-x-selection () (:rest)
"Universal rat-less X paste."
(let ((cmd (concatenate 'string "insert " (get-x-selection))))
(eval-command cmd)))
(defcommand microphone-toggle-on-off () ()
"Toggle microphone on/off"
(run-shell-command "pactl set-source-mute 1 toggle"))
;; ;;This command runs the stumpwm "quit" command, but only if there aren't
;; ;;any windows open.
;; (defcommand "safequit" () ()
;; "Checks if any windows are open before quitting."
;; (let ((win-count 0))
;; ;; Count the windows in each group
;; (dolist (group (screen-groups (current-screen)))
;; (setq win-count (+ (length (group-windows group)) win-count)))
;; ;; Display the number of open windows or quit
;; (if (= win-count 0)
;; (run-commands "quit")
;; (message (format nil "You have ~d ~a open" win-count
;; (if (= win-count 1) "window" "windows"))))))
;;;; Key-bindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; PREFIX KEY
;; ==========
;; Windows key is prefix key. (always use this for all window managers!)
;; ;; Old version. s=windows key
;; (set-prefix-key (kbd "s-q"))
;; (define-key *top-map* (kbd "s-X") "eval")
;; (define-key *top-map* (kbd "s-x") "colon")
;; (define-key *root-map* (kbd "M-x") "colon")
;; new version: bind F20 to windows key / Super_L
(run-shell-command "xmodmap -e \"keycode 133 = F20\"")
(run-shell-command "xmodmap -e \"clear Mod4\"")
(set-prefix-key (kbd "F20"))
;; TOP LEVEL KEY MAP
;; =================
;; Some top-level key-maps (do not require any prefix key) to make it
;; less obtrusive, and kinder to beginners (and behave similar to other WM's):
;; (define-key *top-map* (kbd "M-F2") "dmenu")
;; (define-key *top-map* (kbd "M-F4") "delete")
;; (define-key *top-map* (kbd "M-C-Right") "gnext") ;; messes with my Doom playing, when straifing!
;; (define-key *top-map* (kbd "M-C-Left") "gprev")
;; (define-key *top-map* (kbd "M-C-S-Right") "gnext-with-window") ;; use mod + g + P/N instead
;; (define-key *top-map* (kbd "M-C-S-Left") "gprev-with-window")
(define-key *top-map* (kbd "M-TAB") "next-in-frame")
(define-key *top-map* (kbd "M-RET") "fullscreen")
;; Make M-C-number switch to group:
(dotimes (i 10)
(unless (eq i 0) ; don't use 0
(define-key *top-map* (kbd (format nil "M-C-~a" i)) (format nil "gselect ~a" i))))
;; Make M-C-S-number move window to group:
(dotimes (i 10)
(unless (eq i 0) ; don't use 0
(define-key *top-map* (kbd (format nil "M-C-S-~a" i)) (format nil "gmove ~a" i))))
(defvar PULSEAUDIO nil)
(defvar ALSA t)
(cond (PULSEAUDIO
(define-key *top-map* (kbd "XF86AudioMute") "exec pactl set-sink-mute 0 toggle")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec pactl set-sink-mute 0 false ; pactl set-sink-volume 0 +2%")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec pactl set-sink-mute 0 false ; pactl set-sink-volume 0 -2%"))
(ALSA
(define-key *top-map* (kbd "XF86AudioMute") "exec amixer sset Master toggle >/dev/null")
(define-key *top-map* (kbd "XF86AudioRaiseVolume") "exec amixer -c 0 sset Master 2dB+ >/dev/null")
(define-key *top-map* (kbd "XF86AudioLowerVolume") "exec amixer -c 0 sset Master 2dB- >/dev/null")))
(if (not AT_HOME)
;;C-z doesn't seem to work without this at work computer
(define-key *top-map* (kbd "C-z") "send-escape"))
;; ROOT LEVEL KEY MAP
;; ==================
;; now specify the key bindings one _should_ use (requires prefixing)
;; insted of the top-level ones, which are only there for beginners,
;; etc.
(define-key *root-map* (kbd "F2") "dmenu")
(define-key *root-map* (kbd "F4") "delete")
(define-key *root-map* (kbd "n") "gnext")
(define-key *root-map* (kbd "p") "gprev")
(define-key *root-map* (kbd "q") "fselect") ;; like tmux
(define-key *root-map* (kbd "y") "clipmenu")
;; (define-key *top-map* (kbd "M-C-g") "grouplist")
;; (define-key *top-map* (kbd "M-C-w") "windowlist")
;; (define-key *top-map* (kbd "s-RET") "fullscreen")
;; push the window in the adjacent frame
(define-key *root-map* (kbd "S-Up") "move-window up")
(define-key *root-map* (kbd "S-Left") "move-window left")
(define-key *root-map* (kbd "S-Down") "move-window down")
(define-key *root-map* (kbd "S-Right") "move-window right")
(define-key *root-map* (kbd "Delete") "repack-window-numbers")
(define-key *root-map* (kbd "I") "show-window-properties")
;;switch behavior (w->W; W->w):
(define-key *root-map* (kbd "w") "windowlist")
(define-key *root-map* (kbd "W") "windows")
;;switch behavior (g->G; G->g):
(define-key *groups-map* (kbd "g") "grouplist")
(define-key *groups-map* (kbd "G") "vgroups")
;;(define-key *groups-map* (kbd "G") "groups") ;;pointless if %g in mode line
;; make l behave like "
(define-key *root-map* (kbd "l") "windowlist")
(define-key *groups-map* (kbd "l") "grouplist")
;; keybinding to start programs
(define-key *root-map* (kbd "e") "emacs")
(define-key *root-map* (kbd "t") "term")
(define-key *root-map* (kbd "L") "exec xscreensaver-command -lock")
(define-key *root-map* (kbd "c") "conkeror")
(define-key *root-map* (kbd "T") "tmux")
;; Make M-C-number switch to group:
(dotimes (i 10)
(unless (eq i 0) ; don't use 0
(define-key *root-map* (kbd (format nil "~a" i)) (format nil "gselect ~a" i))))
;;;; Window placement rules ;;;;;;;;;;;;;;;;;;;;;
;; Clear rules
(clear-window-placement-rules)
;; Last rule to match takes precedence!
;; TIP: if the argument to :title or :role begins with an ellipsis, a substring
;; match is performed.
;; TIP: if the :create flag is set then a missing group will be created and
;; restored from *data-dir*/create file.
;; TIP: if the :restore flag is set then group dump is restored even for an
;; existing group using *data-dir*/restore file.
;; (frame-number raise lock &key create restore dump-name class instance type role title)
;;
;; frame-number
;; The frame number to send matching windows to
;; raise
;; When non-nil, raise and focus the window in its frame
;; lock
;; When this is nil, this rule will only match when the current group
;; matches target-group. When non-nil, this rule matches regardless
;; of the group and the window is sent to target-group. If lock and
;; raise are both non-nil, then stumpwm will jump to the specified
;; group and focus the matched window.
;; create
;; When non-NIL the group is created and eventually restored when the
;; value of create is a group dump filename in *DATA-DIR*. Defaults
;; to NIL.
;; restore
;; When non-NIL the group is restored even if it already exists. This
;; arg should be set to the dump filename to use for forced
;; restore. Defaults to NIL
;; class
;; The window's class must match class.
;; instance
;; The window's instance/resource name must match instance.
;; type
;; The window's type must match type.
;; role
;; The window's role must match role.
;; title
;; The window's title must match title.
(define-frame-preference "Main"
;; frame raise lock (lock AND raise == jumpto)
(0 t t :class "Urxvt"))
(define-frame-preference "Net"
;; frame raise lock (lock AND raise == jumpto)
(1 t t :class "Conkeror")
(0 t t :instance "tmux-torrent"))
(define-frame-preference "Emacs"
(1 t t :class "Emacs"))
;;create (floating?) group if it doesn't exist:
;; (define-frame-preference "Minecraft"
;; (0 t t :title "Minecraft Launcher" :create t))
;; pdfpc rule - for 'Default' group
;; move to frame '1';
;; non-focussing ('nil) the presentation view;
;; not only matching (t) the target-group ('Default');
;; moving the 'pdfpc' 'presentation' window
;; FROM: https://babbagefiles.xyz/pdfpc-in-stumpwm/
(define-frame-preference "Default"
(1 nil t :instance "pdfpc" :role "presentation"))
;;Deny the Gnuplot window from taking focus unless clicked upon.
;; prefix-; show-window-properties to see which class a window belongs to
(push '(:class "Gnuplot") stumpwm:*deny-raise-request*) ;;on SUSE Gnuplot class is not set!
(push '(:title "Gnuplot") stumpwm:*deny-raise-request*)
(push '(:class "matplotlib") stumpwm:*deny-raise-request*)
;;;; Misc ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; debugging (look at ".xsession-errors"), 0 (off) - 10 (on)
;;(setf stumpwm::*debug-level* 0)
;;move mouse from focused window:
(defun banish-mouse (from-group to-group)
(if (typep (current-group) 'stumpwm::tile-group)
;; ...or use to-group instead of (current-group), should be same.
(run-commands "banish")))
(add-hook *focus-group-hook* 'banish-mouse)
(setf
*startup-message* nil
*mouse-focus-policy* :click
*input-history-ignore-duplicates* T
*run-or-raise-all-groups* T
;; *time-format-string-default* "%a %Y/%m/%d %I:%M%p"
;; *time-modeline-string* "%a %Y/%m/%d %I:%M%p"
)
;; ;;Shows key-sequence being pressed, this works kind of like emacs'
;; ;;mode-line except as messages. (Gives warnings about unused variables
;; ;;val & key) Plus, clogs upp message history.
;; (defun show-key-seq (key seq val)
;; (message (print-key-seq (reverse seq))))
;; (add-hook *key-press-hook* 'show-key-seq)
;;;; Frames ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; I just don't like zero indexing frames/windows. 0 is not next to 1
;; on the keyboard! See
;; http://lists.gnu.org/archive/html/stumpwm-devel/2006-08/msg00002.html
(setf *frame-number-map* "1234567890")
;;; frame
(set-frame-outline-width 1)
;; (setf *new-window-preferred-frame* '(:empty :focused))
;;;; Windows ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Window border colors.
(set-win-bg-color BACKGROUND-COLOR)
;;Window border colors
(set-focus-color BORDER-COLOR)
(set-unfocus-color BACKGROUND-COLOR)
(set-normal-gravity :center)
(set-maxsize-gravity :center)
(set-transient-gravity :center)
(setf
*normal-border-width* BORDER-WIDTH
*window-border-style* :thin
;; *window-number-map* "aoeuidhtns"
*window-format* "%m%n%s %c %t"
)
;; The width in pixels given to the borders of regular windows.
(setf *normal-border-width* BORDER-WIDTH)
;; The width in pixels given to the borders of windows with maxsize or ratio hints.
(setf *maxsize-border-width* BORDER-WIDTH)
;; The width in pixels given to the borders of transient or pop-up windows.
(setf *transient-border-width* BORDER-WIDTH)
;;;; The Mode Line ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; turn on/off the mode line for the current head only.
;; path to where I have the contrib modules https://github.com/stumpwm/stumpwm-contrib
(set-module-dir (pathname-as-directory (concat (getenv "HOME") "/usr/src/stumpwm-contrib")))
;;(load-module "aumix")
;;(load-module "mpd")
(load-module "mem")
(load-module "cpu")
(load-module "net")
(setf *mode-line-background-color* BACKGROUND-COLOR
*mode-line-foreground-color* FOREGROUND-COLOR
*mode-line-border-color* BORDER-COLOR
*mode-line-border-width* BORDER-WIDTH
;;*mode-line-screen-position* :top
*mode-line-timeout* 1
*mode-line-pad-x* 0
*mode-line-pad-y* 0)
(if AT_HOME
(setf *screen-mode-line-format* (list "[%g] | %c %f %C %t | %M |"))
(setf *screen-mode-line-format* (list "[%g] | %c %f %C %t | %M | %l <> ")))
;; ;;Try for time&date to the right: (The ^> before %d makes it right-aligned.)
;; (setf *time-modeline-string* "%Y-%m-%d %a ^B%l:%M^b")
;; (setf *screen-mode-line-format* (list "[^B%n^b]%W" "^>[%d]"))
;; turn on the modeline
(if (not (head-mode-line (current-head)))
(toggle-mode-line (current-screen) (current-head)))
;; A head is a physical monitor. A screen is a section of video memory
;; that heads are mapped on to. When using xinerama you generally have
;; 1 screen and many heads. When not using xinerama each screen is a
;; physical monitor so you have many screens with only one head on them.
;;;;; The Message Window ;;;;;;;;;;;;;;;;;;;;;;;;;
(set-fg-color FOREGROUND-COLOR)
(set-bg-color BACKGROUND-COLOR)
(set-border-color BORDER-COLOR)
(set-msg-border-width BORDER-WIDTH)
(setf *message-window-gravity* :top-right
;; In seconds (integer), how long a message will appear.
*timeout-wait* 3
;; *input-history-ignore-duplicates* T
*input-window-gravity* :top-right)
;; Message window font
(set-font FONT)
;;;;; Menu ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defparameter *start-menu*
'(("Graphics"
("Color Picker" "gcolor2")
("GIMP" "gimp")
("Inkscape" "inkscape"))
("Internet"
("Conkeror" "conkeror")
("Skype" "skype"))
("Sound and Video"
("Europe 1" "mplayer http://vipicecast.yacast.net/europe1")
("RTL" "mplayer http://streaming.radio.rtl.fr/rtl-1-44-96")
("Mixer" "urxvtcd -rv -e alsamixer")
("Eject CD-ROM" "eject cdrom"))
("System Tools"
("File Manager" "urxvtcd -e mc")
("Terminal Server" "tsclient")
;; Turn on "Enable window manager's key bindings" for prefix key to
;; be passed seamlessly (when *not* in full screen).
;; Toggle between full screen and not full screen using
;; `Ctrl-Alt-Enter'.
;; > In the case of Rdesktop you have to launch the app with the option
;; > '-K' so Stump can retain control over the key combinations that you
;; > input inside the remote session.
("VirtualBox" "VirtualBox"))
("X Windows Tools"
("Clipboard" "xclipboard")
("Fonts" "xfontsel")
("Events" "xev"))))
(defcommand menu () ()
"docstring"
(labels ((pick (options)
(let ((selection (stumpwm::select-from-menu
(current-screen) options "")))
(cond
((null selection)
(throw 'stumpwm::error "Abort."))
((stringp (second selection))
(second selection))
(t
(pick (cdr selection)))))))
(let ((choice (pick *start-menu*)))
(run-shell-command choice))))
(define-key *root-map* (kbd "M") "menu")
;; ;;;; Swap groups ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; Lets you use gforward and gbackward to move a group.
;; (defun swap-groups (group1 group2)
;; (rotatef (slot-value group1 'number) (slot-value group2 'number)))
;; (defun move-group-forward (&optional (group (current-group)))
;; (swap-groups group (next-group group (sort-groups (current-screen)))))
;; (defun move-group-backward (&optional (group (current-group)))
;; (swap-groups group (next-group group (reverse (sort-groups (current-screen))))))
;; (defcommand "gforward" () ()
;; "Move group forward in stacking order."
;; (move-group-forward)
;; (echo-groups (current-screen) *group-format*))
;; (defcommand "gbackward" () ()
;; "Move group backward in stacking order."
;; (move-group-backward)
;; (echo-groups (current-screen) *group-format*))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; from simias
(defun shift-windows-forward (frames win)
(when frames
(let ((frame (car frames)))
(shift-windows-forward (cdr frames)
(frame-window frame))
(when win
(pull-window win frame)))))
(defcommand rotate-windows () ()
"cyckle through running windows in current frame layout"
(let* ((frames (group-frames (current-group)))
(win (frame-window (car (last frames)))))
(shift-windows-forward frames win)))
;; swap 2 windows
(define-key *root-map* (kbd ",") "rotate-windows")
;; from simias
(defcommand toggle-split () ()
"when 2 frames: toggle betwix hsplit/vsplit"
(let* ((group (current-group))
(cur-frame (tile-group-current-frame group))
(frames (group-frames group)))
(if (eq (length frames) 2)
(progn (if (or (neighbour :left cur-frame frames)
(neighbour :right cur-frame frames))
(progn
(only)
(vsplit))
(progn
(only)
(hsplit))))
(message "Works only with 2 frames"))))
;; toggle between vertical split and horizontal split
(define-key *root-map* (kbd ".") "toggle-split")
;;;; Swank ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; With swank installed (use quicklisp, rather than Emacs/ELPA), we
;; can use emacs/swank to debug stump!
;; install in sbcl: (QL:QUICKLOAD :SWANK)
;; (if require doesn't work, use ql:quickload or asdf:load-system instead)
(require 'swank)
;;(asdf:load-system 'swank)
(defvar *swank-running* nil)
(unless *swank-running*
(swank:create-server :port 4004 ;; don't use default 4005, instead use its own port.
;; scotj doens't use these two lines:
:style swank:*communication-style*
:dont-close t)
(echo-string (current-screen) "Starting swank. M-x slime-connect RET 4004")
(setf *swank-running* t))
;; M-x slime-connect, host: 127.0.0.1. port: 4004 (not 4005). You are
;; now inside the live Lisp image of your WM! E.g. then from slime REPL:
;; CL-USER> (require :stumpwm)
;; NIL
;; CL-USER> (stumpwm:select-window-by-number 1)
;; NIL
;; (in-package #:stumpwm)
;;;; Start-up commands ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Get rid of cursor initially
(banish-pointer)
;; Create groups
(run-commands
"grename Main"
"term"
"gnewbg Emacs"
"gnewbg Net")
;; (if AT_HOME
;; (run-shell-command "urxvtcd -name tmux-torrent -e torrent.sh"))
(run-commands "gselect 1")
;; (load-module "numpad-layouts")
;; (numpad-layouts:set-numpad-layout 'se)
;; This is for the sake of Emacs.
;; Local Variables:
;; coding: utf-8
;; mode: common-lisp
;; ispell-local-dictionary: "en_US"
;; End: