From ef565a486511cbbb86e0d1f80264b3b57d2ac88a Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Sat, 10 Jun 2023 09:36:37 +0200 Subject: Migrate from .org to .el Emacs config. --- .config/emacs/exwm/desktop.el | 150 ------------------------------------------ .config/emacs/exwm/start.sh | 12 ---- 2 files changed, 162 deletions(-) delete mode 100644 .config/emacs/exwm/desktop.el delete mode 100644 .config/emacs/exwm/start.sh (limited to '.config/emacs/exwm') diff --git a/.config/emacs/exwm/desktop.el b/.config/emacs/exwm/desktop.el deleted file mode 100644 index 512dbdc..0000000 --- a/.config/emacs/exwm/desktop.el +++ /dev/null @@ -1,150 +0,0 @@ -(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/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)) - -(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)))) - -(use-package exwm - :config - (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 "nitrogen" nil "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 "xmodmap" nil "xmodmap ~/dotfiles/.Xmodmap") - - (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]))) - - (setq exwm-input-prefix-keys - '(?\C-x - ?\C-u - ?\C-h - ?\M-x - ?\M-` - ?\M-& - ?\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)) - -(use-package desktop-environment - :after exwm - :config (desktop-environment-mode) - :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%-")) - -(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 deleted file mode 100644 index 127e858..0000000 --- a/.config/emacs/exwm/start.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -picom & - -xss-lock -- slock & - -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 -- cgit v1.2.3