From 8e9d2ec5a8aa966b7ada92fe9c4a5bfc80979e57 Mon Sep 17 00:00:00 2001 From: jdlugosz963 Date: Wed, 21 Sep 2022 20:53:30 +0200 Subject: Add EXWM config --- .config/emacs/exwm/EXWM.desktop | 8 +++ .config/emacs/exwm/Xmodmap | 2 + .config/emacs/exwm/desktop.el | 100 +++++++++++++++++++++++++++ .config/emacs/exwm/start.sh | 10 +++ EXWM.org | 149 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 269 insertions(+) create mode 100644 .config/emacs/exwm/EXWM.desktop create mode 100644 .config/emacs/exwm/Xmodmap create mode 100644 .config/emacs/exwm/desktop.el create mode 100644 .config/emacs/exwm/start.sh create mode 100644 EXWM.org 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 @@ +[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/Xmodmap b/.config/emacs/exwm/Xmodmap new file mode 100644 index 0000000..cb4706f --- /dev/null +++ b/.config/emacs/exwm/Xmodmap @@ -0,0 +1,2 @@ +clear lock +keycode 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 @@ +(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/exwm-init-hook () + (display-battery-mode t) + (display-time-mode t) + + (jd-exwm/run-in-background "nm-applet") + (jd-exwm/run-in-background "pasystray") + (jd-exwm/run-in-background "blueman-applet")) + +(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)) + ("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 9) + + (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 ~/.config/emacs/exwm/Xmodmap") + (start-process-shell-command "nitrogen" nil "nitrogen --restore") + (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1") + + (require 'exwm-randr) + (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]))) + + (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 1 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 '(95 . 95)) +(add-to-list 'default-frame-alist `(alpha . (95 . 95))) +(set-frame-parameter (selected-frame) 'fullscreen 'maximized) +(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 @@ +#!/bin/sh + +picom & + +xss-lock -- slock & + +export VISUAL=emacsclient +export EDITOR="$VISUAL" + +exec 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 @@ +#+title: EXW Configuration +#+author: jdlugosz963 +#+PROPERTY: header-args:emacs-lisp :tangle .config/emacs/exwm/desktop.el + + +* EXWM + +#+begin_src emacs-lisp + + (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/exwm-init-hook () + (display-battery-mode t) + (display-time-mode t) + + (jd-exwm/run-in-background "nm-applet") + (jd-exwm/run-in-background "pasystray") + (jd-exwm/run-in-background "blueman-applet")) + + (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)) + ("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 9) + + (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 ~/.config/emacs/exwm/Xmodmap") + (start-process-shell-command "nitrogen" nil "nitrogen --restore") + (start-process-shell-command "xinput" nil "xinput set-prop 11 336 1") + + (require 'exwm-randr) + (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]))) + + (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 1 9)))) + + (exwm-enable)) + +#+end_src + +* Desktop mode + +#+begin_src emacs-lisp + + (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%-")) + +#+end_src + +* Transparency + +#+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) 'fullscreen 'maximized) + (add-to-list 'default-frame-alist '(fullscreen . maximized)) + +#+end_src + + +* Start emacs + +#+begin_src sh :tangle ~/.config/emacs/exwm/start.sh + #!/bin/sh + + picom & + + xss-lock -- slock & + + export VISUAL=emacsclient + export EDITOR="$VISUAL" + + exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/exwm/desktop.el + +#+end_src + +* Xmodmap + +#+begin_src sh :tangle ~/.config/emacs/exwm/Xmodmap + +clear lock +keycode 0x42 = Escape + +#+end_src -- cgit v1.2.3