summaryrefslogtreecommitdiffstats
path: root/Desktop.org
diff options
context:
space:
mode:
Diffstat (limited to 'Desktop.org')
-rw-r--r--Desktop.org525
1 files changed, 0 insertions, 525 deletions
diff --git a/Desktop.org b/Desktop.org
deleted file mode 100644
index 595e278..0000000
--- a/Desktop.org
+++ /dev/null
@@ -1,525 +0,0 @@
1#+title: Desktop Configuration
2#+author: jdlugosz963
3#+PROPERTY: header-args:emacs-lisp :tangle .config/emacs/exwm/desktop.el
4
5
6* EXWM
7** Config
8
9#+begin_src emacs-lisp
10
11 (defun jd/exwm-update-class ()
12 (exwm-workspace-rename-buffer exwm-class-name))
13
14 (defun jd-exwm/run-in-background (command)
15 (let ((command-parts (split-string command "[ ]+")))
16 (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
17
18 (defun jd-exwm/restart-process (program-name)
19 (call-process "killall" nil nil nil program-name)
20 (jd-exwm/run-in-background program-name))
21
22 (defun jd-exwm/exwm-init-hook ()
23 (jd-exwm/run-in-background "nitrogen --restore")
24 (start-process-shell-command "xinput" nil "xinput set-prop 'ETPS/2 Elantech Touchpad' 'Synaptics Tap Action' 1 1 1 2 1")
25 (start-process-shell-command "syndaemon" nil "syndaemon -i 0.8 -K -R -d")
26
27 (jd-exwm/restart-process "polybar")
28 (jd-exwm/restart-process "nm-applet")
29 (jd-exwm/restart-process "redshift-gtk -l 54.37:18.6")
30 (jd-exwm/restart-process "blueman-applet"))
31
32 (defun jd-exwm/exwm-update-title ()
33 (exwm-workspace-rename-buffer exwm-title))
34
35 (defun jd-exwm/configure-window-by-class ()
36 (interactive)
37 (pcase exwm-class-name
38 ("firefox" (exwm-workspace-move-window 2))
39 ("Brave" (exwm-workspace-move-window 2))
40 ("qutebrowser" (exwm-workspace-move-window 2))
41 ("discord" (exwm-workspace-move-window 5))
42 ("obs" (exwm-workspace-move-window 5))
43 ("Virt-manager" (exwm-workspace-move-window 4))))
44
45 (use-package exwm
46 :config
47 (setq exwm-workspace-number 10)
48
49 (add-hook 'exwm-init-hook #'jd-exwm/exwm-init-hook)
50 (add-hook 'exwm-update-class-hook #'jd/exwm-update-class)
51 (add-hook 'exwm-update-title-hook #'jd-exwm/exwm-update-title)
52 (add-hook 'exwm-manage-finish-hook #'jd-exwm/configure-window-by-class)
53
54 (require 'exwm-randr)
55 (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1"))
56 (exwm-randr-enable)
57
58 (setq exwm-input-simulation-keys
59 '(([?\C-h] . [left])
60 ([?\C-l] . [right])
61 ([?\C-k] . [up])
62 ([?\C-j] . [down])))
63
64 (setq exwm-input-prefix-keys
65 '(?\C-x
66 ?\C-u
67 ?\C-h
68 ?\M-x
69 ?\M-`
70 ?\M-&
71 ?\M-:
72 ?\C-\M-j
73 ?\C-\ ))
74
75 (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key)
76 (exwm-input-set-key (kbd "s-p") 'counsel-linux-app)
77
78 (setq exwm-input-global-keys
79 `(([?\s-R] . exwm-reset)
80
81
82 ([?\s-r] . (lambda (command)
83 (interactive (list (read-shell-command "$ ")))
84 (start-process-shell-command command nil command)))
85
86 ([?\s-W] . exwm-workspace-move-window)
87 ([?\s-w] . exwm-workspace-switch)
88
89 ,@(mapcar (lambda (i)
90 `(,(kbd (format "s-%d" i)) .
91 (lambda ()
92 (interactive)
93 (exwm-workspace-switch-create ,i))))
94 (number-sequence 0 9))))
95
96 (exwm-enable))
97
98#+end_src
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 '(90 . 90))
119 (add-to-list 'default-frame-alist `(alpha . (90 . 90)))
120 (set-frame-parameter (selected-frame) 'fullscreen 'maximized)
121 (add-to-list 'default-frame-alist '(fullscreen . maximized))
122
123#+end_src
124
125** Update colorsheme
126#+begin_src emacs-lisp
127
128 (defun jd-exwm/get-color (ATTRIBUTE)
129 (face-attribute 'default ATTRIBUTE))
130
131 (defun theme-to-xresources ()
132 (interactive)
133 (require 'term)
134 (with-temp-buffer
135 (insert "! Generated by theme-to-xresources\n")
136 (dolist (spec
137 '(("emacs.background" :background "E6")
138 ("emacs.foreground" :foreground "")))
139 (let ((color (jd-exwm/get-color (cadr spec))))
140 (insert (format "%s: #%s%s\n"
141 (car spec)
142 (caddr spec)
143 (string-remove-prefix "#" color))))
144 (write-region (point-min) (point-max) "~/.Xresources")))
145 (call-process "xrdb" nil nil nil "-merge" (expand-file-name "~/.Xresources")))
146
147 (defun jd/theme-sync ()
148 (interactive)
149 (theme-to-xresources)
150 (setq org-confirm-babel-evaluate nil)
151 (org-babel-tangle-file "~/dotfiles/Desktop.org")
152 (setq org-confirm-babel-evaluate 't)
153 (call-process "killall" nil nil nil "dunst") ;; TODO: prevent clear notification history
154 (jd-exwm/restart-process "polybar"))
155
156 (add-hook 'jd/load-theme-hook #'jd/theme-sync)
157 (add-hook 'exwm-init-hook #'jd/theme-sync)
158
159
160#+end_src
161** Start emacs
162
163#+begin_src sh :tangle ~/.config/emacs/exwm/start.sh
164 #!/bin/sh
165
166 picom &
167
168 xss-lock -- slock &
169
170 export VISUAL="emacsclient -a vim"
171 export EDITOR="$VISUAL"
172 export GTK_THEME="Adwaita:dark"
173 export CALIBRE_USE_DARK_PALETTE=1
174
175 gentoo-pipewire-launcher &
176
177 exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el
178
179#+end_src
180
181* Dunst
182*Dunst keybinds in Emacs*
183
184#+begin_src emacs-lisp
185
186 (defun jd/dunst-show-history ()
187 (interactive)
188 (start-process-shell-command "dunstctl" nil "dunstctl history-pop"))
189
190 (defun jd/dunst-close ()
191 (interactive)
192 (start-process-shell-command "dunstctl" nil "dunstctl close"))
193
194 (defun jd/dunst-close-all ()
195 (interactive)
196 (start-process-shell-command "dunstctl" nil "dunstctl close-all"))
197
198 (jd/leader-key-def
199 "d" '(nil :which-key "dunst")
200 "dh" '(jd/dunst-show-history :which-key "show history")
201 "dc" '(jd/dunst-close :which-key "close")
202 "da" '(jd/dunst-close-all :which-key "close all"))
203
204#+end_src
205
206*Get emacs colors*
207#+NAME: get-color
208#+BEGIN_SRC elisp :var ATTR="" :tangle no :eval yes
209 (if (and (stringp ATTR) (s-prefix-p ":" ATTR))
210 (jd-exwm/get-color (intern ATTR))
211 "")
212#+END_SRC
213
214*dunstrc*
215
216#+begin_src conf :tangle .config/dunst/dunstrc :noweb yes :eval yes
217
218 [global]
219 frame_width = 2
220 frame_color = "<<get-color(":foreground")>>"
221 font = sourcecodepro
222
223 # Allow a small subset of html markup:
224 # <b>bold</b>
225 # <i>italic</i>
226 # <s>strikethrough</s>
227 # <u>underline</u>
228 #
229 # For a complete reference see
230 # <http://developer.gnome.org/pango/stable/PangoMarkupFormat.html>.
231 # If markup is not allowed, those tags will be stripped out of the
232 # message.
233 markup = yes
234
235 # The format of the message. Possible variables are:
236 # %a appname
237 # %s summary
238 # %b body
239 # %i iconname (including its path)
240 # %I iconname (without its path)
241 # %p progress value if set ([ 0%] to [100%]) or nothing
242 # Markup is allowed
243 format = "%s %p\n%b"
244
245 # Sort messages by urgency.
246 sort = yes
247
248 # Show how many messages are currently hidden (because of geometry).
249 indicate_hidden = yes
250
251 # Alignment of message text.
252 # Possible values are "left", "center" and "right".
253 alignment = left
254
255 # The frequency with wich text that is longer than the notification
256 # window allows bounces back and forth.
257 # This option conflicts with "word_wrap".
258 # Set to 0 to disable.
259 bounce_freq = 5
260
261
262 # Show age of message if message is older than show_age_threshold
263 # seconds.
264 # Set to -1 to disable.
265 show_age_threshold = 60
266
267 # Split notifications into multiple lines if they don't fit into
268 # geometry.
269 word_wrap = no
270
271 # Ignore newlines '\n' in notifications.
272 ignore_newline = no
273
274
275 # The geometry of the window:
276 # [{width}]x{height}[+/-{x}+/-{y}]
277 # The geometry of the message window.
278 # The height is measured in number of notifications everything else
279 # in pixels. If the width is omitted but the height is given
280 # ("-geometry x2"), the message window expands over the whole screen
281 # (dmenu-like). If width is 0, the window expands to the longest
282 # message displayed. A positive x is measured from the left, a
283 # negative from the right side of the screen. Y is measured from
284 # the top and down respectevly.
285 # The width can be negative. In this case the actual width is the
286 # screen width minus the width defined in within the geometry option.
287 geometry = "500x10-10+50"
288
289 # Shrink window if it's smaller than the width. Will be ignored if
290 # width is 0.
291 shrink = yes
292
293 # The transparency of the window. Range: [0; 100].
294 # This option will only work if a compositing windowmanager is
295 # present (e.g. xcompmgr, compiz, etc.).
296 transparency = 15
297
298 # Don't remove messages, if the user is idle (no mouse or keyboard input)
299 # for longer than idle_threshold seconds.
300 # Set to 0 to disable.
301 # default 120
302 idle_threshold = 120
303
304 # Which monitor should the notifications be displayed on.
305 monitor = 0
306
307 # Display notification on focused monitor. Possible modes are:
308 # mouse: follow mouse pointer
309 # keyboard: follow window with keyboard focus
310 # none: don't follow anything
311 #
312 # "keyboard" needs a windowmanager that exports the
313 # _NET_ACTIVE_WINDOW property.
314 # This should be the case for almost all modern windowmanagers.
315 #
316 # If this option is set to mouse or keyboard, the monitor option
317 # will be ignored.
318 follow = mouse
319
320 # Should a notification popped up from history be sticky or timeout
321 # as if it would normally do.
322 sticky_history = yes
323
324 # Maximum amount of notifications kept in history
325 history_length = 20
326
327 # Display indicators for URLs (U) and actions (A).
328 show_indicators = yes
329
330 # The height of a single line. If the height is smaller than the
331 # font height, it will get raised to the font height.
332 # This adds empty space above and under the text.
333 line_height = 0
334
335 # Draw a line of "separator_height" pixel height between two
336 # notifications.
337 # Set to 0 to disable.
338 separator_height = 1
339
340 # Padding between text and separator.
341 # padding = 8
342 padding = 8
343
344 # Horizontal padding.
345 horizontal_padding = 10
346
347 # Define a color for the separator.
348 # possible values are:
349 # * auto: dunst tries to find a color fitting to the background;
350 # * foreground: use the same color as the foreground;
351 # * frame: use the same color as the frame;
352 # * anything else will be interpreted as a X color.
353 separator_color = #263238
354
355 # Print a notification on startup.
356 # This is mainly for error detection, since dbus (re-)starts dunst
357 # automatically after a crash.
358 startup_notification = false
359
360 # dmenu path.
361 dmenu = /usr/bin/dmenu -p dunst:
362
363 # Browser for opening urls in context menu.
364 browser = palemoon
365
366 # Align icons left/right/off
367 icon_position = left
368
369 # Limit icons size.
370 max_icon_size=128
371
372 [urgency_low]
373 # IMPORTANT: colors have to be defined in quotation marks.
374 # Otherwise the "#" and following would be interpreted as a comment.
375 background = "<<get-color(":background")>>"
376 foreground = "#888888"
377 timeout = 10
378 # Icon for notifications with low urgency, uncomment to enable
379 #icon = /path/to/icon
380
381 [urgency_normal]
382 background = "<<get-color(":background")>>"
383 foreground = "<<get-color(":foreground")>>"
384 timeout = 10
385 # Icon for notifications with normal urgency, uncomment to enable
386 #icon = /path/to/icon
387
388 [urgency_critical]
389 background = "#900000"
390 foreground = "#ffffff"
391 frame_color = "#ff0000"
392 timeout = 0
393 # Icon for notifications with critical urgency, uncomment to enable
394 #icon = /path/to/icon
395#+end_src
396
397* Polybar
398
399#+begin_src conf :tangle .config/polybar/config.ini
400
401 [settings]
402 screenchange-reload = true
403 pseudo-transparency = true
404
405 [colors]
406 background = ${xrdb:emacs.background}
407 foreground = ${xrdb:emacs.foreground}
408 primary = #7fd962
409 disabled = #707880
410
411 [bar/example]
412 width = 100%
413 height = 18pt
414
415 background = ${colors.background}
416 foreground = ${colors.foreground}
417
418 line-size = 1.5pt
419
420 padding-left = 0
421 padding-right = 1
422
423 module-margin = 1
424
425 separator = |
426 separator-foreground = ${colors.disabled}
427
428 font-0 = "sourcecodepro:size=11"
429 font-1 = "FontAwesome"
430
431 modules-left = xworkspaces
432 modules-right = memory cpu battery date
433
434 cursor-click = pointer
435 cursor-scroll = ns-resize
436
437 enable-ipc = true
438
439 tray-position = right
440
441 [module/xworkspaces]
442 type = internal/xworkspaces
443
444 icon-0 = 1;0
445 icon-1 = 2;1
446 icon-2 = 3;2
447 icon-3 = 4;3
448 icon-4 = 5;4
449 icon-5 = 6;5
450 icon-6 = 7;6
451 icon-7 = 8;7
452 icon-8 = 9;8
453 icon-9 = 10;9
454
455 label-active = %icon%
456 label-active-background = ${colors.background-alt}
457 label-active-underline= ${colors.primary}
458 label-active-padding = 1
459
460 label-occupied = %icon%
461 label-occupied-padding = 1
462
463 label-urgent = %icon%
464 label-urgent-background = ${colors.alert}
465 label-urgent-padding = 1
466
467 label-empty = %icon%
468 label-empty-foreground = ${colors.disabled}
469 label-empty-padding = 1
470
471 [module/battery]
472 type = internal/battery
473 battery = BAT0
474 adapter = ADP1
475
476 format-charging = <animation-charging> <label-charging>
477 format-discharging = <ramp-capacity> <label-discharging>
478 format-low = <ramp-capacity> <label-low>
479 format-full = <ramp-capacity> <label-full>
480
481 label-charging = %percentage%%
482 label-discharging = %percentage%%
483 label-low = LOW %percentage%%
484 label-full = FULL %percentage%%
485
486 ramp-capacity-0 = 
487 ramp-capacity-1 = 
488 ramp-capacity-2 = 
489 ramp-capacity-3 = 
490 ramp-capacity-4 = 
491 ramp-capacity-foreground = ${colors.primary}
492
493 animation-charging-0 = 
494 animation-charging-1 = 
495 animation-charging-2 = 
496 animation-charging-3 = 
497 animation-charging-4 = 
498 animation-charging-foreground = ${colors.primary}
499 animation-charging-framerate = 750
500
501 [module/memory]
502 type = internal/memory
503 interval = 2
504 format-prefix = "RAM "
505 format-prefix-foreground = ${colors.primary}
506 label = %percentage_used:2%%
507
508 [module/cpu]
509 type = internal/cpu
510 interval = 2
511 format-prefix = "CPU "
512 format-prefix-foreground = ${colors.primary}
513 label = %percentage:2%%
514
515 [module/date]
516 type = internal/date
517 interval = 1
518
519 date = %H:%M
520 date-alt = %Y-%m-%d %H:%M:%S
521
522 label = %date%
523 label-foreground = ${colors.primary}
524
525#+end_src