summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjdlugosz963 <jdlugosz963@gmail.com>2022-09-21 20:53:30 +0200
committerjdlugosz963 <jdlugosz963@gmail.com>2022-09-21 20:53:30 +0200
commit8e9d2ec5a8aa966b7ada92fe9c4a5bfc80979e57 (patch)
treee411daa136a558ebebdab3e3b9b4ac3696ab79e4
parent3edfc2e08b00d66babc743ebc4c75d9a4507832a (diff)
downloaddotfiles-8e9d2ec5a8aa966b7ada92fe9c4a5bfc80979e57.tar.gz
dotfiles-8e9d2ec5a8aa966b7ada92fe9c4a5bfc80979e57.zip
Add EXWM config
-rw-r--r--.config/emacs/exwm/EXWM.desktop8
-rw-r--r--.config/emacs/exwm/Xmodmap2
-rw-r--r--.config/emacs/exwm/desktop.el100
-rw-r--r--.config/emacs/exwm/start.sh10
-rw-r--r--EXWM.org149
5 files changed, 269 insertions, 0 deletions
diff --git a/.config/emacs/exwm/EXWM.desktop b/.config/emacs/exwm/EXWM.desktop
new file mode 100644
index 0000000..1717437
--- /dev/null
+++ b/.config/emacs/exwm/EXWM.desktop
@@ -0,0 +1,8 @@
1[Desktop Entry]
2Name=EXWM
3Comment=Emacs Window Manager
4Exec=sh /home/jakub/.config/emacs/exwm/start.sh
5TryExec=sh
6Type=Application
7X-LightDM-DesktopName=exwm
8DesktopNames=exwm
diff --git a/.config/emacs/exwm/Xmodmap b/.config/emacs/exwm/Xmodmap
new file mode 100644
index 0000000..cb4706f
--- /dev/null
+++ b/.config/emacs/exwm/Xmodmap
@@ -0,0 +1,2 @@
1clear lock
2keycode 0x42 = Escape
diff --git a/.config/emacs/exwm/desktop.el b/.config/emacs/exwm/desktop.el
new file mode 100644
index 0000000..1643961
--- /dev/null
+++ b/.config/emacs/exwm/desktop.el
@@ -0,0 +1,100 @@
1(defun jd/exwm-update-class ()
2 (exwm-workspace-rename-buffer exwm-class-name))
3
4(defun jd-exwm/run-in-background (command)
5 (let ((command-parts (split-string command "[ ]+")))
6 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
7
8(defun jd-exwm/exwm-init-hook ()
9 (display-battery-mode t)
10 (display-time-mode t)
11
12 (jd-exwm/run-in-background "nm-applet")
13 (jd-exwm/run-in-background "pasystray")
14 (jd-exwm/run-in-background "blueman-applet"))
15
16(defun jd-exwm/exwm-update-title ()
17 (exwm-workspace-rename-buffer exwm-title))
18
19(defun jd-exwm/configure-window-by-class ()
20 (interactive)
21 (pcase exwm-class-name
22 ("firefox" (exwm-workspace-move-window 2))
23 ("qutebrowser" (exwm-workspace-move-window 2))
24 ("discord" (exwm-workspace-move-window 5))
25 ("obs" (exwm-workspace-move-window 5))
26 ("Virt-manager" (exwm-workspace-move-window 4))))
27
28(use-package exwm
29 :config
30 (setq exwm-workspace-number 9)
31
32 (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
33 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
34 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
35 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
36
37 (start-process-shell-command "xmodmap" nil "xmodmap ~/.config/emacs/exwm/Xmodmap")
38 (start-process-shell-command "nitrogen" nil "nitrogen --restore")
39 (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1")
40
41 (require 'exwm-randr)
42 (exwm-randr-enable)
43 ;; (start-process-shell-command "xrandr" nil "xrandr --output DP-1-8 --primary --mode 1920x1080 --output eDP-1 --off")
44
45 (require 'exwm-systemtray)
46 (exwm-systemtray-enable)
47
48 (setq exwm-input-simulation-keys
49 '(([?\C-l] . [left])
50 ([?\C-h] . [right])
51 ([?\C-k] . [up])
52 ([?\C-j] . [down])))
53
54 (setq exwm-input-prefix-keys
55 '(?\C-x
56 ?\C-u
57 ?\C-h
58 ?\M-x
59 ?\M-`
60 ?\M-&
61 ?\M-:
62 ?\C-\M-j
63 ?\C-\ ))
64
65 (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
66 (exwm-input-set-key (kbd "s-p") 'counsel-linux-app)
67
68 (setq exwm-input-global-keys
69 `(([?\s-R] . exwm-reset)
70
71
72 ([?\s-r] . (lambda (command)
73 (interactive (list (read-shell-command "$ ")))
74 (start-process-shell-command command nil command)))
75
76 ([?\s-W] . exwm-workspace-move-window)
77 ([?\s-w] . exwm-workspace-switch)
78
79 ,@(mapcar (lambda (i)
80 `(,(kbd (format "s-%d" i)) .
81 (lambda ()
82 (interactive)
83 (exwm-workspace-switch-create ,i))))
84 (number-sequence 1 9))))
85
86 (exwm-enable))
87
88(use-package desktop-environment
89 :after exwm
90 :config (desktop-environment-mode)
91 :custom
92 (desktop-environment-brightness-small-increment "2%+")
93 (desktop-environment-brightness-small-decrement "2%-")
94 (desktop-environment-brightness-normal-increment "5%+")
95 (desktop-environment-brightness-normal-decrement "5%-"))
96
97(set-frame-parameter (selected-frame) 'alpha '(95 . 95))
98(add-to-list 'default-frame-alist `(alpha . (95 . 95)))
99(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
100(add-to-list 'default-frame-alist '(fullscreen . maximized))
diff --git a/.config/emacs/exwm/start.sh b/.config/emacs/exwm/start.sh
new file mode 100644
index 0000000..476d4b0
--- /dev/null
+++ b/.config/emacs/exwm/start.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2
3picom &
4
5xss-lock -- slock &
6
7export VISUAL=emacsclient
8export EDITOR="$VISUAL"
9
10exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el
diff --git a/EXWM.org b/EXWM.org
new file mode 100644
index 0000000..61f2534
--- /dev/null
+++ b/EXWM.org
@@ -0,0 +1,149 @@
1#+title: EXW Configuration
2#+author: jdlugosz963
3#+PROPERTY: header-args:emacs-lisp :tangle .config/emacs/exwm/desktop.el
4
5
6* EXWM
7
8#+begin_src emacs-lisp
9
10 (defun jd/exwm-update-class ()
11 (exwm-workspace-rename-buffer exwm-class-name))
12
13 (defun jd-exwm/run-in-background (command)
14 (let ((command-parts (split-string command "[ ]+")))
15 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
16
17 (defun jd-exwm/exwm-init-hook ()
18 (display-battery-mode t)
19 (display-time-mode t)
20
21 (jd-exwm/run-in-background "nm-applet")
22 (jd-exwm/run-in-background "pasystray")
23 (jd-exwm/run-in-background "blueman-applet"))
24
25 (defun jd-exwm/exwm-update-title ()
26 (exwm-workspace-rename-buffer exwm-title))
27
28 (defun jd-exwm/configure-window-by-class ()
29 (interactive)
30 (pcase exwm-class-name
31 ("firefox" (exwm-workspace-move-window 2))
32 ("qutebrowser" (exwm-workspace-move-window 2))
33 ("discord" (exwm-workspace-move-window 5))
34 ("obs" (exwm-workspace-move-window 5))
35 ("Virt-manager" (exwm-workspace-move-window 4))))
36
37 (use-package exwm
38 :config
39 (setq exwm-workspace-number 9)
40
41 (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
42 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
43 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
44 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
45
46 (start-process-shell-command "xmodmap" nil "xmodmap ~/.config/emacs/exwm/Xmodmap")
47 (start-process-shell-command "nitrogen" nil "nitrogen --restore")
48 (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1")
49
50 (require 'exwm-randr)
51 (exwm-randr-enable)
52 ;; (start-process-shell-command "xrandr" nil "xrandr --output DP-1-8 --primary --mode 1920x1080 --output eDP-1 --off")
53
54 (require 'exwm-systemtray)
55 (exwm-systemtray-enable)
56
57 (setq exwm-input-simulation-keys
58 '(([?\C-l] . [left])
59 ([?\C-h] . [right])
60 ([?\C-k] . [up])
61 ([?\C-j] . [down])))
62
63 (setq exwm-input-prefix-keys
64 '(?\C-x
65 ?\C-u
66 ?\C-h
67 ?\M-x
68 ?\M-`
69 ?\M-&
70 ?\M-:
71 ?\C-\M-j
72 ?\C-\ ))
73
74 (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
75 (exwm-input-set-key (kbd "s-p") 'counsel-linux-app)
76
77 (setq exwm-input-global-keys
78 `(([?\s-R] . exwm-reset)
79
80
81 ([?\s-r] . (lambda (command)
82 (interactive (list (read-shell-command "$ ")))
83 (start-process-shell-command command nil command)))
84
85 ([?\s-W] . exwm-workspace-move-window)
86 ([?\s-w] . exwm-workspace-switch)
87
88 ,@(mapcar (lambda (i)
89 `(,(kbd (format "s-%d" i)) .
90 (lambda ()
91 (interactive)
92 (exwm-workspace-switch-create ,i))))
93 (number-sequence 1 9))))
94
95 (exwm-enable))
96
97#+end_src
98
99* Desktop mode
100
101#+begin_src emacs-lisp
102
103 (use-package desktop-environment
104 :after exwm
105 :config (desktop-environment-mode)
106 :custom
107 (desktop-environment-brightness-small-increment "2%+")
108 (desktop-environment-brightness-small-decrement "2%-")
109 (desktop-environment-brightness-normal-increment "5%+")
110 (desktop-environment-brightness-normal-decrement "5%-"))
111
112#+end_src
113
114* Transparency
115
116#+begin_src emacs-lisp
117
118 (set-frame-parameter (selected-frame) 'alpha '(95 . 95))
119 (add-to-list 'default-frame-alist `(alpha . (95 . 95)))
120 (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
121 (add-to-list 'default-frame-alist '(fullscreen . maximized))
122
123#+end_src
124
125
126* Start emacs
127
128#+begin_src sh :tangle ~/.config/emacs/exwm/start.sh
129 #!/bin/sh
130
131 picom &
132
133 xss-lock -- slock &
134
135 export VISUAL=emacsclient
136 export EDITOR="$VISUAL"
137
138 exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el
139
140#+end_src
141
142* Xmodmap
143
144#+begin_src sh :tangle ~/.config/emacs/exwm/Xmodmap
145
146clear lock
147keycode 0x42 = Escape
148
149#+end_src