-
Notifications
You must be signed in to change notification settings - Fork 0
/
exwm-config.el
82 lines (71 loc) · 2.74 KB
/
exwm-config.el
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
(require 'exwm)
;; Following is taken from (exwm-config-default), with some changes.
;; Set the initial workspace number.
(setq exwm-workspace-number 5)
(setq exwm-workspace-index-map (lambda (i) (nth i '("web " "prog" "cli " "edit" "misc"))))
(setq exwm-workspace-show-all-buffers t)
(setq exwm-layout-show-all-buffers t)
;; Hide or show mode-line depending on whether in line- or char-mode
(defun exwm-input-set-mode-line ()
(with-current-buffer (window-buffer)
(when (eq major-mode 'exwm-mode)
(if (equal (nth 1 (nth 1 mode-line-process)) "line")
(exwm-layout-hide-mode-line)
(exwm-layout-show-mode-line)))))
;; Add current exwm workspace to mode-line
(add-to-list 'mode-line-front-space
'(:eval (propertize
(apply exwm-workspace-index-map (list exwm-workspace-current-index))
'face 'mode-line-buffer-id)))
;; Make class name the buffer name
(add-hook 'exwm-update-title-hook
(lambda ()
(exwm-workspace-rename-buffer
(truncate-string-to-width (format "%s : %s" exwm-class-name exwm-title)
43 0 nil "..."))))
;;;; Keybindings
;;; Global keys
;; 's-r': Reset
(exwm-input-set-key (kbd "s-r") #'exwm-reset)
;; 's-w': Switch workspace
(exwm-input-set-key (kbd "s-w") #'exwm-workspace-switch)
;; 's-N': Switch to certain workspace
(dotimes (i 9)
(exwm-input-set-key (kbd (format "s-%d" (1+ i)))
`(lambda ()
(interactive)
(exwm-workspace-switch ,i))))
;; 's-p': Launch application
(exwm-input-set-key (kbd "s-p")
(lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
;; 's-RET': Launch terminal
(exwm-input-set-key (kbd "<s-return>")
(lambda ()
(interactive)
(start-process-shell-command "urxvtc" nil "urxvtc")))
;;; Local keybindings (just in line-mode). Taken from
;;; https://github.com/carbohydratesn/spacemacs/blob/deea9318ff806ff4e530e3fcce3ea829b0a76d45/layers/%2Bwindow-management/exwm/packages.el
;; Press C-q to send key to X window.
(push ?\C-q exwm-input-prefix-keys)
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
;; Universal Get-me-outta-here
(push ?\C-g exwm-input-prefix-keys)
;; Universal Arguments
(push ?\C-u exwm-input-prefix-keys)
(push ?\C-0 exwm-input-prefix-keys)
(push ?\C-1 exwm-input-prefix-keys)
(push ?\C-2 exwm-input-prefix-keys)
(push ?\C-3 exwm-input-prefix-keys)
(push ?\C-4 exwm-input-prefix-keys)
(push ?\C-5 exwm-input-prefix-keys)
(push ?\C-6 exwm-input-prefix-keys)
(push ?\C-7 exwm-input-prefix-keys)
(push ?\C-8 exwm-input-prefix-keys)
(push ?\C-9 exwm-input-prefix-keys)
(delete ?\C-v exwm-input-prefix-keys)
(require 'exwm-systemtray)
(setq exwm-systemtray-height 15)
(exwm-systemtray-enable)
(exwm-enable)