From a3ab59de884a372226432ba50dd3c36e354ff22e Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sat, 31 Dec 2022 23:20:53 +0100 Subject: Update Desktop config --- .config/emacs/exwm/EXWM.desktop | 8 --- .config/emacs/exwm/desktop.el | 90 +++++++++++++++++++++++++-------- .config/emacs/exwm/start.sh | 4 +- .config/polybar/config.ini | 7 +-- Desktop.org | 107 ++++++++++++++++++++++++++++------------ 5 files changed, 151 insertions(+), 65 deletions(-) delete mode 100644 .config/emacs/exwm/EXWM.desktop 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 @@ -[Desktop Entry] -Name=EXWM -Comment=Emacs Window Manager -Exec=sh /home/jakub/.config/emacs/exwm/start.sh -TryExec=sh -Type=Application -X-LightDM-DesktopName=exwm -DesktopNames=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 @@ (let ((command-parts (split-string command "[ ]+"))) (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) -(defun jd-exwm/exwm-init-hook () - (display-battery-mode t) - (display-time-mode t) +(defun jd-exwm/restart-process (program-name) + (call-process "killall" nil nil nil program-name) + (jd-exwm/run-in-background program-name)) - (jd-exwm/run-in-background "nm-applet") - (jd-exwm/run-in-background "pasystray") - (jd-exwm/run-in-background "blueman-applet")) +(defun jd-exwm/exwm-init-hook () + (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") + (jd-exwm/restart-process "pasystray")) (defun jd-exwm/exwm-update-title () (exwm-workspace-rename-buffer exwm-title)) @@ -20,6 +23,7 @@ (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)) @@ -27,29 +31,26 @@ (use-package exwm :config - (setq exwm-workspace-number 9) + (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) - (start-process-shell-command "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap") (start-process-shell-command "nitrogen" nil "nitrogen --restore") - (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1") + (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 "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap") (require 'exwm-randr) + (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1")) (exwm-randr-enable) - ;; (start-process-shell-command "xrandr" nil "xrandr --output DP-1-8 --primary --mode 1920x1080 --output eDP-1 --off") - - (require 'exwm-systemtray) - (exwm-systemtray-enable) (setq exwm-input-simulation-keys - '(([?\C-l] . [left]) - ([?\C-h] . [right]) - ([?\C-k] . [up]) - ([?\C-j] . [down]))) + '(([?\C-b] . [left]) + ([?\C-f] . [right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]))) (setq exwm-input-prefix-keys '(?\C-x @@ -81,7 +82,7 @@ (lambda () (interactive) (exwm-workspace-switch-create ,i)))) - (number-sequence 1 9)))) + (number-sequence 0 9)))) (exwm-enable)) @@ -94,7 +95,56 @@ (desktop-environment-brightness-normal-increment "5%+") (desktop-environment-brightness-normal-decrement "5%-")) -(set-frame-parameter (selected-frame) 'alpha '(95 . 95)) -(add-to-list 'default-frame-alist `(alpha . (95 . 95))) +(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)))) + (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) + +(defun jd/dunst-show-history () + (interactive) + (start-process-shell-command "dunstctl" nil "dunstctl history-pop")) + +(defun jd/dunst-close () + (interactive) + (start-process-shell-command "dunstctl" nil "dunstctl close")) + +(defun jd/dunst-close-all () + (interactive) + (start-process-shell-command "dunstctl" nil "dunstctl close-all")) + +(jd/leader-key-def + "d" '(nil :which-key "dunst") + "dh" '(jd/dunst-show-history :which-key "show history") + "dc" '(jd/dunst-close :which-key "close") + "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 & xss-lock -- slock & -export VISUAL=emacsclient +export VISUAL="emacsclient -a vim" export EDITOR="$VISUAL" +export GTK_THEME="Adwaita:dark" +export CALIBRE_USE_DARK_PALETTE=1 exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el diff --git a/.config/polybar/config.ini b/.config/polybar/config.ini index 8e79a12..4af4e40 100644 --- a/.config/polybar/config.ini +++ b/.config/polybar/config.ini @@ -3,12 +3,9 @@ screenchange-reload = true pseudo-transparency = true [colors] -background = #F20d1017 -background-alt = #131721 -foreground = #C5C8C6 +background = ${xrdb:emacs.background} +foreground = ${xrdb:emacs.foreground} primary = #7fd962 -secondary = #bfbdb6 -alert = #A54242 disabled = #707880 [bar/example] diff --git a/Desktop.org b/Desktop.org index 04d6be3..e24607e 100644 --- a/Desktop.org +++ b/Desktop.org @@ -15,13 +15,16 @@ (let ((command-parts (split-string command "[ ]+"))) (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts))))) - (defun jd-exwm/exwm-init-hook () - (display-battery-mode t) - (display-time-mode t) + (defun jd-exwm/restart-process (program-name) + (call-process "killall" nil nil nil program-name) + (jd-exwm/run-in-background program-name)) - (jd-exwm/run-in-background "nm-applet") - (jd-exwm/run-in-background "pasystray") - (jd-exwm/run-in-background "blueman-applet")) + (defun jd-exwm/exwm-init-hook () + (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") + (jd-exwm/restart-process "pasystray")) (defun jd-exwm/exwm-update-title () (exwm-workspace-rename-buffer exwm-title)) @@ -30,6 +33,7 @@ (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)) @@ -37,29 +41,26 @@ (use-package exwm :config - (setq exwm-workspace-number 9) + (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) - (start-process-shell-command "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap") (start-process-shell-command "nitrogen" nil "nitrogen --restore") - (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1") + (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 "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap") (require 'exwm-randr) + (setq exwm-randr-workspace-monitor-plist '(9 "eDP-1" 0 "eDP-1")) (exwm-randr-enable) - ;; (start-process-shell-command "xrandr" nil "xrandr --output DP-1-8 --primary --mode 1920x1080 --output eDP-1 --off") - - (require 'exwm-systemtray) - (exwm-systemtray-enable) (setq exwm-input-simulation-keys - '(([?\C-l] . [left]) - ([?\C-h] . [right]) - ([?\C-k] . [up]) - ([?\C-j] . [down]))) + '(([?\C-b] . [left]) + ([?\C-f] . [right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]))) (setq exwm-input-prefix-keys '(?\C-x @@ -91,7 +92,7 @@ (lambda () (interactive) (exwm-workspace-switch-create ,i)))) - (number-sequence 1 9)))) + (number-sequence 0 9)))) (exwm-enable)) @@ -115,13 +116,49 @@ #+begin_src emacs-lisp - (set-frame-parameter (selected-frame) 'alpha '(95 . 95)) - (add-to-list 'default-frame-alist `(alpha . (95 . 95))) + (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)) #+end_src +** Update colorsheme +#+begin_src emacs-lisp + + (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)))) + (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) + + +#+end_src ** Start emacs #+begin_src sh :tangle ~/.config/emacs/exwm/start.sh @@ -131,8 +168,10 @@ xss-lock -- slock & - export VISUAL=emacsclient + export VISUAL="emacsclient -a vim" export EDITOR="$VISUAL" + export GTK_THEME="Adwaita:dark" + export CALIBRE_USE_DARK_PALETTE=1 exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el @@ -163,13 +202,21 @@ #+end_src +*Get emacs colors* +#+NAME: get-color +#+BEGIN_SRC elisp :var ATTR="" :tangle no :eval yes + (if (and (stringp ATTR) (s-prefix-p ":" ATTR)) + (jd-exwm/get-color (intern ATTR)) + "") +#+END_SRC + *dunstrc* -#+begin_src conf :tangle .config/dunst/dunstrc +#+begin_src conf :tangle .config/dunst/dunstrc :noweb yes :eval yes [global] frame_width = 2 - frame_color = "#39bae6" + frame_color = "<>" font = sourcecodepro # Allow a small subset of html markup: @@ -324,15 +371,15 @@ [urgency_low] # IMPORTANT: colors have to be defined in quotation marks. # Otherwise the "#" and following would be interpreted as a comment. - background "#0d1017" + background = "<>" foreground = "#888888" timeout = 10 # Icon for notifications with low urgency, uncomment to enable #icon = /path/to/icon [urgency_normal] - background = "#1e2128" - foreground = "#ffffff" + background = "<>" + foreground = "<>" timeout = 10 # Icon for notifications with normal urgency, uncomment to enable #icon = /path/to/icon @@ -347,6 +394,7 @@ #+end_src * Polybar + #+begin_src conf :tangle .config/polybar/config.ini [settings] @@ -354,12 +402,9 @@ pseudo-transparency = true [colors] - background = #F20d1017 - background-alt = #131721 - foreground = #C5C8C6 + background = ${xrdb:emacs.background} + foreground = ${xrdb:emacs.foreground} primary = #7fd962 - secondary = #bfbdb6 - alert = #A54242 disabled = #707880 [bar/example] -- cgit v1.2.3