-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathsettings.lisp
120 lines (92 loc) · 3.54 KB
/
settings.lisp
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
;;; settings.lisp --- General settings: variables, hooks, ...
;; Copyright © 2013–2021 Alex Kost <alezost@gmail.com>
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Code:
(in-package :stumpwm)
;;; Windows, frames and groups
;; Name the default group.
(setf (group-name (car (screen-groups (current-screen))))
"tile1")
(gnewbg "tile2")
(gnewbg-float "float")
(set-normal-gravity :top)
(setf
*message-window-gravity* :bottom-right
*input-window-gravity* :center
*mouse-focus-policy* :click)
(defvar al/frames1 nil)
(defun al/make-frames1 ()
"Return a frame layout (list of frames) for `al/frames1'."
(let* ((screen (current-screen))
(s-width (screen-width screen))
(s-height (screen-height screen))
(f0-width (/ s-width 2))
(f0-height (* 3 (/ f0-width 4)))
(f0 (make-frame
:number 0
:x 0 :y 0
:width f0-width
:height f0-height))
(f1 (make-frame
:number 1
:x 0 :y f0-height
:width f0-width
:height (- s-height f0-height)))
(f2 (make-frame
:number 2
:x f0-width :y 0
:width (- s-width f0-width)
:height s-height)))
(list f0 f2 f1)))
(defcommand al/frames1 (&optional (populatep t)) ()
"Show layout of 3 frames with one frame having 4/3 ratio."
(al/set-frames (or al/frames1
(setf al/frames1 (al/make-frames1)))
populatep))
;;; Keyboard layouts
;; This is needed because stumpwm opens display before extension
;; definition.
(xlib::initialize-extensions *display*)
(xlib:enable-xkeyboard *display*)
(al/set-display-layout 0)
(al/enable-per-window-layout)
;;; Message after a part of key sequence
;; Idea and code came from `which-key-mode' command and
;; <https://github.com/stumpwm/stumpwm/wiki/FAQ#how-do-i-make-keypresses-show-up-in-a-message-window-as-i-press-them>.
(defun al/key-seq-msg (_key key-seq cmd)
"Show a message with current incomplete key sequence."
(declare (ignore _key))
(unless (or (stringp cmd)
(eq *top-map* *resize-map*))
(let* ((oriented-key-seq (reverse key-seq))
(maps (get-kmaps-at-key-seq (dereference-kmaps (top-maps))
oriented-key-seq)))
(when maps
(let ((*message-window-gravity* :center))
(message "~A" (print-key-seq oriented-key-seq)))))))
(add-hook *key-press-hook* 'al/key-seq-msg)
;;; Misc
(setf *top-level-error-action* :message)
;; Original `send-fake-key' sends only "press" event.
(setf (symbol-function 'send-fake-key)
(lambda (win key) (al/send-key key win)))
(setf *deny-raise-request*
'((:class "Conkeror")
(:class "firefox")
(:class "IceCat")
(:class "FLTK") ; xcas
(:class "libreoffice-writer")))
(al/banish-pointer)
;; (setf *debug-level* 10) ; show all debug info
;;; settings.lisp ends here