blob: 4d503f5e12a03cf6acbf19bcb75145f01368e442 (
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
|
;; Time-stamp: <2020-04-24 17:52:54 (tslil@bison)>
(defun banish-rat ()
(interactive)
(shell-command "xdotool mousemove 1280 800")
(message "Rat banished."))
(use-package exwm
:if (window-system)
:ensure t
:demand
:config
(setq exwm-workspace-number 1
exwm-workspace-switch-create-limit 5
exwm-workspace-show-all-buffers nil)
(add-hook 'exwm-update-class-hook
(lambda ()
(exwm-workspace-rename-buffer exwm-class-name)))
;; -------------------------------------------------------------------
;; Global key binds
(setq exwm-input-simulation-keys
'(([?\C-b] . [left])
([?\C-f] . [right])
([?\C-p] . [up])
([?\C-n] . [down])
([?\C-a] . [home])
([?\C-e] . [end])
([?\M-v] . [prior])
([?\C-v] . [next])
([?\C-s] . [C-f])
;;([?\C-d] . [delete])
;;([?\C-k] . [S-end delete])
))
;; IME
(defvar exwm-workman-intl t)
(defun exwm-toggle-intl-ime ()
(interactive)
(let ((result (call-process-shell-command
(concat "setxkbmap -layout us -variant workman"
(if exwm-workman-intl "-intl" "")
" -option terminate:ctrl_alt_bksp -option ctrl:nocaps"))))
(if (not (= 0 result))
(message "Unable to switch keyboard layouts.")
(message (concat (if exwm-workman-intl "INTERNATIONAL" "STANDARD") " layout selected."))
(setq exwm-workman-intl (not exwm-workman-intl)))))
(exwm-input-set-key (kbd "s-i") 'exwm-toggle-intl-ime)
;; reset
(exwm-input-set-key (kbd "s-r") 'exwm-reset)
;; workspaces
(exwm-input-set-key (kbd "s-e") 'exwm-workspace-switch)
(dotimes (i 10)
(exwm-input-set-key (kbd (format "s-%d" i))
`(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
;; buffer and window management
(exwm-input-set-key (kbd "s-SPC") 'switch-to-buffer)
(defvar exwm-workspace-last-index 0)
(defun exwm-workspace-lighter ()
(format " @%d (*%d)" exwm-workspace-current-index exwm-workspace-last-index))
(defun exwm-store-workspace-last-index-switch (frame-or-index &optional force)
(setq exwm-workspace-last-index exwm-workspace-current-index))
(advice-add 'exwm-workspace-switch :before #'exwm-store-workspace-last-index-switch)
(defun exwm-sanitise-workspace-last-index ()
(when (> (1+ exwm-workspace-last-index) (exwm-workspace--count))
(setq exwm-workspace-last-index exwm-workspace-current-index)))
(push #'exwm-sanitise-workspace-last-index exwm-workspace-list-change-hook)
(defun exwm-last-workspace ()
(interactive)
(exwm-workspace-switch-create exwm-workspace-last-index))
(defun exwm-last-buffer ()
(interactive)
(switch-to-buffer (other-buffer (current-buffer) 1)))
(exwm-input-set-key (kbd "s-o") 'exwm-last-buffer)
(exwm-input-set-key (kbd "s-<tab>") 'exwm-last-workspace)
(exwm-input-set-key (kbd "s-b") 'banish-rat)
;; run command
(exwm-input-set-key (kbd "s-c") (lambda ()
(interactive)
(start-process "" nil "st")))
(exwm-input-set-key (kbd "s-q") (lambda ()
(interactive)
(start-process "" nil "iceweasel")))
(exwm-input-set-key (kbd "s-<f2>") (lambda ()
(interactive)
(start-process "" nil "lock")))
(exwm-input-set-key (kbd "s-p") (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; -------------------------------------------------------------------
;; Tray
(require 'exwm-systemtray)
(exwm-systemtray-enable)
(setq exwm-systemtray-height 24)
;; -------------------------------------------------------------------
;; RandR
(require 'exwm-randr)
(exwm-randr-enable)
(setq exwm-randr-workspace-monitor-plist
'(1 "LVDS1" 0 "VGA1"))
(exwm-enable))
;; -----------------------------------------------------------------------------
;; EXWM-edit
(use-package exwm-edit
:ensure t
:config
(add-hook 'exwm-edit-compose-hook (lambda ()
(text-mode))))
|