blob: 98b5e89a667dd47f06a8b47c81ee45ccdf8a2034 (
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
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
|
;;; Dotfiles --- Jakub Dlugosz emacs config
;;; Commentary:
;;; Code:
(use-package! perspective "emacs-perspective")
(use-package! exwm "emacs-exwm"
:config
(defun jd/exwm-update-class ()
(exwm-workspace-rename-buffer exwm-class-name))
(defun jd-exwm/run-in-background (command)
(let ((command-parts (split-string command "[ ]+")))
(apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
(defun jd-exwm/restart-process (program-name)
(call-process "killall" nil nil nil program-name)
(jd-exwm/run-in-background program-name))
(defun jd-exwm/exwm-init-hook ()
(jd-exwm/run-in-background "nitrogen --restore")
(start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1")
(start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d")
(jd-exwm/restart-process "polybar")
(jd-exwm/restart-process "nm-applet")
(jd-exwm/restart-process "redshift-gtk -l 54.37:18.6")
(jd-exwm/restart-process "blueman-applet"))
(defun jd-exwm/exwm-update-title ()
(exwm-workspace-rename-buffer exwm-title))
(defun jd-exwm/configure-window-by-class ()
(interactive)
(pcase exwm-class-name
("firefox" (exwm-workspace-move-window 2))
("Brave" (exwm-workspace-move-window 2))
("qutebrowser" (exwm-workspace-move-window 2))
("discord" (exwm-workspace-move-window 5))
("obs" (exwm-workspace-move-window 5))
("Virt-manager" (exwm-workspace-move-window 4))))
(setq exwm-workspace-number 10)
;; (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
(add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
(add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
(add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
(require 'exwm-randr)
(setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1"))
(exwm-randr-enable)
(setq exwm-input-simulation-keys
'(([?\C-b] . [left])
([?\C-f] . [right])
([?\C-p] . [up])
([?\C-n] . [down])
([?\C-a] . [home])
([?\C-e] . [end])
([?\C-k] . [S-end delete])
([?\M-w] . [C-c])
([?\C-y] . [C-v])
([?\C-v] . [next])
([?\M-v] . [prior])
))
(setq exwm-input-prefix-keys
'(?\C-x
?\C-u
?\C-h
?\M-x
?\M-`
?\M-&
?\M-!
?\C-g
?\M-:
?\C-\M-j
?\C-\ ))
(define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
(exwm-input-set-key (kbd "s-p") 'counsel-linux-app)
(setq exwm-input-global-keys
`(([?\s-R] . exwm-reset)
([?\s-r] . (lambda (command)
(interactive (list (read-shell-command "$ ")))
(start-process-shell-command command nil command)))
([?\s-W] . exwm-workspace-move-window)
([?\s-w] . exwm-workspace-switch)
,@(mapcar (lambda (i)
`(,(kbd (format "s-%d" i)) .
(lambda ()
(interactive)
(exwm-workspace-switch-create ,i))))
(number-sequence 0 9))))
(exwm-enable)
(require 'exwm-systemtray)
(exwm-systemtray-enable))
(use-package! desktop-environment "emacs-desktop-environment"
:after exwm
:custom
(desktop-environment-brightness-small-increment "2%+")
(desktop-environment-brightness-small-decrement "2%-")
(desktop-environment-brightness-normal-increment "5%+")
(desktop-environment-brightness-normal-decrement "5%-")
:config
(defun jd/dunst-show-history ()
(interactive)
(start-process-shell-command "dunstctl" nil "dunstctl history-pop"))
(global-set-key (kbd "C-c N h") #'jd/dunst-show-history)
(defun jd/dunst-close ()
(interactive)
(start-process-shell-command "dunstctl" nil "dunstctl close"))
(global-set-key (kbd "C-c N c") #'jd/dunst-close)
(defun jd/dunst-close-all ()
(interactive)
(start-process-shell-command "dunstctl" nil "dunstctl close-all"))
(global-set-key (kbd "C-c N a") #'jd/dunst-close-all)
(desktop-environment-mode))
;; (set-frame-parameter (selected-frame) 'alpha '(90 . 90))
;; (add-to-list 'default-frame-alist `(alpha . (90 . 90)))
;; (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
;; (add-to-list 'default-frame-alist '(fullscreen . maximized))
(defun jd-exwm/get-color (ATTRIBUTE)
(face-attribute 'default ATTRIBUTE))
(defun theme-to-xresources ()
(interactive)
(require 'term)
(with-temp-buffer
(insert "! Generated by theme-to-xresources\n")
(dolist (spec
'(("emacs.background" :background "E6")
("emacs.foreground" :foreground "")))
(let ((color (jd-exwm/get-color (cadr spec))))
(insert (format "%s: #%s%s\n"
(car spec)
(caddr spec)
(string-remove-prefix "#" color))))
jd
(write-region (point-min) (point-max) "~/.Xresources")))
(call-process "xrdb" nil nil nil "-merge" (expand-file-name "~/.Xresources")))
(defun jd/theme-sync ()
(interactive)
(theme-to-xresources)
(setq org-confirm-babel-evaluate nil)
(org-babel-tangle-file "~/dotfiles/Desktop.org")
(setq org-confirm-babel-evaluate 't)
(call-process "killall" nil nil nil "dunst") ;; TODO: prevent clear notification history
(jd-exwm/restart-process "polybar"))
;; (add-hook 'jd/load-theme-hook #'jd/theme-sync)
;; (add-hook 'exwm-init-hook #'jd/theme-sync)
(provide 'jd-exwm)
;;; jd-exwm.el ends here
|