summaryrefslogtreecommitdiffstats
path: root/.config/emacs
diff options
context:
space:
mode:
Diffstat (limited to '.config/emacs')
-rw-r--r--.config/emacs/exwm/EXWM.desktop8
-rw-r--r--.config/emacs/exwm/desktop.el90
-rw-r--r--.config/emacs/exwm/start.sh4
3 files changed, 73 insertions, 29 deletions
diff --git a/.config/emacs/exwm/EXWM.desktop b/.config/emacs/exwm/EXWM.desktop
deleted file mode 100644
index 1717437..0000000
--- a/.config/emacs/exwm/EXWM.desktop
+++ /dev/null
@@ -1,8 +0,0 @@
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/desktop.el b/.config/emacs/exwm/desktop.el
index 579e6b2..512dbdc 100644
--- a/.config/emacs/exwm/desktop.el
+++ b/.config/emacs/exwm/desktop.el
@@ -5,13 +5,16 @@
5 (let ((command-parts (split-string command "[ ]+"))) 5 (let ((command-parts (split-string command "[ ]+")))
6 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) 6 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
7 7
8(defun jd-exwm/exwm-init-hook () 8(defun jd-exwm/restart-process (program-name)
9 (display-battery-mode t) 9 (call-process "killall" nil nil nil program-name)
10 (display-time-mode t) 10 (jd-exwm/run-in-background program-name))
11 11
12 (jd-exwm/run-in-background "nm-applet") 12(defun jd-exwm/exwm-init-hook ()
13 (jd-exwm/run-in-background "pasystray") 13 (jd-exwm/restart-process "polybar")
14 (jd-exwm/run-in-background "blueman-applet")) 14 (jd-exwm/restart-process "nm-applet")
15 (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6")
16 (jd-exwm/restart-process "blueman-applet")
17 (jd-exwm/restart-process "pasystray"))
15 18
16(defun jd-exwm/exwm-update-title () 19(defun jd-exwm/exwm-update-title ()
17 (exwm-workspace-rename-buffer exwm-title)) 20 (exwm-workspace-rename-buffer exwm-title))
@@ -20,6 +23,7 @@
20 (interactive) 23 (interactive)
21 (pcase exwm-class-name 24 (pcase exwm-class-name
22 ("firefox" (exwm-workspace-move-window 2)) 25 ("firefox" (exwm-workspace-move-window 2))
26 ("Brave" (exwm-workspace-move-window 2))
23 ("qutebrowser" (exwm-workspace-move-window 2)) 27 ("qutebrowser" (exwm-workspace-move-window 2))
24 ("discord" (exwm-workspace-move-window 5)) 28 ("discord" (exwm-workspace-move-window 5))
25 ("obs" (exwm-workspace-move-window 5)) 29 ("obs" (exwm-workspace-move-window 5))
@@ -27,29 +31,26 @@
27 31
28(use-package exwm 32(use-package exwm
29 :config 33 :config
30 (setq exwm-workspace-number 9) 34 (setq exwm-workspace-number 10)
31 35
32 (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook) 36 (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
33 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class) 37 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
34 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title) 38 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
35 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class) 39 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
36 40
37 (start-process-shell-command "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap")
38 (start-process-shell-command "nitrogen" nil "nitrogen --restore") 41 (start-process-shell-command "nitrogen" nil "nitrogen --restore")
39 (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1") 42 (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1")
43 (start-process-shell-command "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap")
40 44
41 (require 'exwm-randr) 45 (require 'exwm-randr)
46 (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1"))
42 (exwm-randr-enable) 47 (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
48 (setq exwm-input-simulation-keys 49 (setq exwm-input-simulation-keys
49 '(([?\C-l] . [left]) 50 '(([?\C-b] . [left])
50 ([?\C-h] . [right]) 51 ([?\C-f] . [right])
51 ([?\C-k] . [up]) 52 ([?\C-p] . [up])
52 ([?\C-j] . [down]))) 53 ([?\C-n] . [down])))
53 54
54 (setq exwm-input-prefix-keys 55 (setq exwm-input-prefix-keys
55 '(?\C-x 56 '(?\C-x
@@ -81,7 +82,7 @@
81 (lambda () 82 (lambda ()
82 (interactive) 83 (interactive)
83 (exwm-workspace-switch-create ,i)))) 84 (exwm-workspace-switch-create ,i))))
84 (number-sequence 1 9)))) 85 (number-sequence 0 9))))
85 86
86 (exwm-enable)) 87 (exwm-enable))
87 88
@@ -94,7 +95,56 @@
94 (desktop-environment-brightness-normal-increment "5%+") 95 (desktop-environment-brightness-normal-increment "5%+")
95 (desktop-environment-brightness-normal-decrement "5%-")) 96 (desktop-environment-brightness-normal-decrement "5%-"))
96 97
97(set-frame-parameter (selected-frame) 'alpha '(95 . 95)) 98(set-frame-parameter (selected-frame) 'alpha '(90 . 90))
98(add-to-list 'default-frame-alist `(alpha . (95 . 95))) 99(add-to-list 'default-frame-alist `(alpha . (90 . 90)))
99(set-frame-parameter (selected-frame) 'fullscreen 'maximized) 100(set-frame-parameter (selected-frame) 'fullscreen 'maximized)
100(add-to-list 'default-frame-alist '(fullscreen . maximized)) 101(add-to-list 'default-frame-alist '(fullscreen . maximized))
102
103(defun jd-exwm/get-color (ATTRIBUTE)
104 (face-attribute 'default ATTRIBUTE))
105
106(defun theme-to-xresources ()
107 (interactive)
108 (require 'term)
109 (with-temp-buffer
110 (insert "! Generated by theme-to-xresources\n")
111 (dolist (spec
112 '(("emacs.background" :background "E6")
113 ("emacs.foreground" :foreground "")))
114 (let ((color (jd-exwm/get-color (cadr spec))))
115 (insert (format "%s: #%s%s\n"
116 (car spec)
117 (caddr spec)
118 (string-remove-prefix "#" color))))
119 (write-region (point-min) (point-max) "~/.Xresources")))
120 (call-process "xrdb" nil nil nil "-merge" (expand-file-name "~/.Xresources")))
121
122(defun jd/theme-sync ()
123 (interactive)
124 (theme-to-xresources)
125 (setq org-confirm-babel-evaluate nil)
126 (org-babel-tangle-file "~/dotfiles/Desktop.org")
127 (setq org-confirm-babel-evaluate 't)
128 (call-process "killall" nil nil nil "dunst") ;; TODO: prevent clear notification history
129 (jd-exwm/restart-process "polybar"))
130
131(add-hook 'jd/load-theme-hook #'jd/theme-sync)
132(add-hook 'exwm-init-hook #'jd/theme-sync)
133
134(defun jd/dunst-show-history ()
135 (interactive)
136 (start-process-shell-command "dunstctl" nil "dunstctl history-pop"))
137
138(defun jd/dunst-close ()
139 (interactive)
140 (start-process-shell-command "dunstctl" nil "dunstctl close"))
141
142(defun jd/dunst-close-all ()
143 (interactive)
144 (start-process-shell-command "dunstctl" nil "dunstctl close-all"))
145
146(jd/leader-key-def
147 "d" '(nil :which-key "dunst")
148 "dh" '(jd/dunst-show-history :which-key "show history")
149 "dc" '(jd/dunst-close :which-key "close")
150 "da" '(jd/dunst-close-all :which-key "close all"))
diff --git a/.config/emacs/exwm/start.sh b/.config/emacs/exwm/start.sh
index 476d4b0..127e858 100644
--- a/.config/emacs/exwm/start.sh
+++ b/.config/emacs/exwm/start.sh
@@ -4,7 +4,9 @@ picom &
4 4
5xss-lock -- slock & 5xss-lock -- slock &
6 6
7export VISUAL=emacsclient 7export VISUAL="emacsclient -a vim"
8export EDITOR="$VISUAL" 8export EDITOR="$VISUAL"
9export GTK_THEME="Adwaita:dark"
10export CALIBRE_USE_DARK_PALETTE=1
9 11
10exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el 12exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el