X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/blobdiff_plain/9867e4bbee2bcfe7050b0c9d98cbf72653f658ac..a567a3276f8d953c60b2ad9a25a6509a90f61034:/.emacs.d/lisp/bandali-exwm.el?ds=inline diff --git a/.emacs.d/lisp/bandali-exwm.el b/.emacs.d/lisp/bandali-exwm.el index 99a186b..3072765 100644 --- a/.emacs.d/lisp/bandali-exwm.el +++ b/.emacs.d/lisp/bandali-exwm.el @@ -1,6 +1,6 @@ ;;; bandali-exwm.el --- bandali's EXWM configuration -*- lexical-binding: t; -*- -;; Copyright (C) 2018-2020 Amin Bandali +;; Copyright (C) 2018-2022 Amin Bandali ;; Author: Amin Bandali ;; Keywords: tools @@ -27,8 +27,7 @@ (add-to-list 'load-path (b/lisp "xelb")) (add-to-list 'load-path (b/lisp "exwm")) (require 'exwm) -(csetq ;; exwm-replace t - exwm-workspace-show-all-buffers t) +;; (setq exwm-replace t) ;; make class name the buffer name, truncating beyond 60 characters (defun b/exwm-rename-buffer () (interactive) @@ -86,185 +85,189 @@ around if needed." 5 \% 6 \^ 7 \& 8 \* 9 \() "Mapping of shifted numbers on my keyboard.") -(csetq exwm-workspace-number 10 - exwm-input-global-keys - `(([?\s-R] . exwm-reset) - ([?\s-b] . exwm-workspace-switch-to-buffer) - ([?\s-\\] . exwm-workspace-switch) - ([?\s-\s] . dmenu) - ;; ([?\s-\s] . (lambda () - ;; (interactive) - ;; (start-process-shell-command - ;; "rofi" nil "rofi -show run"))) - ([?\S-\s-\s] . (lambda (command) ; doesn't work in X windows - (interactive - (list (read-shell-command "➜ "))) - (start-process-shell-command - command nil command))) - ([s-return] . (lambda () - (interactive) - (start-process "" nil "urxvt"))) - ([S-s-return] . (lambda () - (interactive) - (start-process "" nil "urxvt" - "-name" "floating"))) - ([?\C-\s-\s] . counsel-linux-app) - ([?\M-\s-\s] . (lambda () - (interactive) - (start-process-shell-command - "rofi-pass" nil "rofi-pass"))) - ([?\s-h] . windmove-left) - ([?\s-j] . windmove-down) - ([?\s-k] . windmove-up) - ([?\s-l] . windmove-right) - ([?\s-H] . windmove-swap-states-left) - ([?\s-J] . windmove-swap-states-down) - ([?\s-K] . windmove-swap-states-up) - ([?\s-L] . windmove-swap-states-right) - ([?\s-N ?d] . (lambda () - (interactive) - (start-process - "" nil "dunstctl" "close"))) - ([?\s-N ?D] . (lambda () - (interactive) - (start-process - "" nil "dunstctl" "close-all"))) - ([?\s-N ?h] . (lambda () - (interactive) - (start-process - "" nil "dunstctl" "history-pop"))) - ([?\s-N return] . (lambda () - (interactive) - (start-process - "" nil "dunstctl" "context"))) - ([?\M-\s-h] . shrink-window-horizontally) - ([?\M-\s-l] . enlarge-window-horizontally) - ([?\M-\s-k] . shrink-window) - ([?\M-\s-j] . enlarge-window) - ([?\s-\[] . b/exwm-ws-prev) - ([?\s-\]] . b/exwm-ws-next) - ([mode-line mouse-4] . b/exwm-ws-prev) ; up - ([mode-line mouse-5] . b/exwm-ws-next) ; down - ([mode-line mouse-6] . b/exwm-ws-prev) ; left - ([mode-line mouse-7] . b/exwm-ws-next) ; right - ([?\s-{] . (lambda () - (interactive) - (exwm-workspace-move-window - (b/exwm-ws-prev-index)))) - ([?\s-}] . (lambda () - (interactive) - (exwm-workspace-move-window - (b/exwm-ws-next-index)))) - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 0 (1- exwm-workspace-number))) - ,@(mapcar - (lambda (i) - `(,(kbd (format "s-%s" - (plist-get b/shifted-ws-names i))) - . - (lambda () - (interactive) - (exwm-workspace-move-window ,i)))) - (number-sequence 0 (1- exwm-workspace-number))) - ([?\s-F] . exwm-floating-toggle-floating) - ([?\s-f] . exwm-layout-toggle-fullscreen) - ([?\s-W] . (lambda () - (interactive) - (kill-buffer (current-buffer)))) - ([?\s-Q] . (lambda () - (interactive) - (exwm-manage--kill-client))) - ([?\s-\'] . (lambda () +(setq + exwm-workspace-number 10 + exwm-input-global-keys + `(([?\s-R] . exwm-reset) + ;; ([?\s-b] . exwm-workspace-switch-to-buffer) + ([?\s-/] . exwm-workspace-switch) + ([?\s-\s] . dmenu) + ([?\s-\\] . (lambda () + (interactive) + (start-process-shell-command + "passmenu" nil "passmenu --type"))) + ([?\S-\s-\s] . (lambda (command) + (interactive + (list (read-shell-command "➜ "))) + (start-process-shell-command + command nil command))) + ([s-return] . (lambda () + (interactive) + (start-process "" nil "xterm"))) + ([S-s-return] . (lambda () + (interactive) + (start-process "" nil "xterm" + "-name" "floating"))) + ([?\C-\s-\s] . counsel-linux-app) + ([?\s-h] . windmove-left) + ([?\s-j] . windmove-down) + ([?\s-k] . windmove-up) + ([?\s-l] . windmove-right) + ([?\s-H] . windmove-swap-states-left) + ([?\s-J] . windmove-swap-states-down) + ([?\s-K] . windmove-swap-states-up) + ([?\s-L] . windmove-swap-states-right) + ([?\s-N ?d] . (lambda () + (interactive) + (start-process + "" nil "dunstctl" "close"))) + ([?\s-N ?D] . (lambda () + (interactive) + (start-process + "" nil "dunstctl" "close-all"))) + ([?\s-N ?h] . (lambda () + (interactive) + (start-process + "" nil "dunstctl" "history-pop"))) + ([?\s-N return] . (lambda () (interactive) - (start-process-shell-command - "rofi-light" nil "rofi-light"))) - ([XF86AudioMute] . ; borken on my X200 :-( + (start-process + "" nil "dunstctl" "context"))) + ([?\M-\s-h] . shrink-window-horizontally) + ([?\M-\s-l] . enlarge-window-horizontally) + ([?\M-\s-k] . shrink-window) + ([?\M-\s-j] . enlarge-window) + ([?\s-\[] . b/exwm-ws-prev) + ([?\s-\]] . b/exwm-ws-next) + ([mode-line mouse-4] . b/exwm-ws-prev) ; up + ([mode-line mouse-5] . b/exwm-ws-next) ; down + ([mode-line mouse-6] . b/exwm-ws-prev) ; left + ([mode-line mouse-7] . b/exwm-ws-next) ; right + ([?\s-{] . (lambda () + (interactive) + (exwm-workspace-move-window + (b/exwm-ws-prev-index)))) + ([?\s-}] . (lambda () + (interactive) + (exwm-workspace-move-window + (b/exwm-ws-next-index)))) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 (1- exwm-workspace-number))) + ,@(mapcar + (lambda (i) + `(,(kbd (format "s-%s" + (plist-get b/shifted-ws-names i))) + . (lambda () (interactive) - (start-process "" nil "pamixer" "--toggle-mute"))) - ([XF86Launch1] . - (lambda () - (interactive) - (start-process "" nil "pamixer" "--toggle-mute"))) - ([\s-XF86Launch1] . ; toggle mic mute - (lambda () - (interactive) - (start-process - "" nil "pamixer" "--default-source" "--toggle-mute"))) - ([XF86AudioLowerVolume] . - (lambda () - (interactive) - (start-process - "" nil "pamixer" "--allow-boost" "--decrease" "5"))) - ([XF86AudioRaiseVolume] . - (lambda () - (interactive) - (start-process - "" nil "pamixer" "--allow-boost" "--increase" "5"))) - ([XF86AudioPlay] . - (lambda () - (interactive) - (start-process "" nil "mpc" "toggle"))) - ([XF86AudioPrev] . - (lambda () - (interactive) - (start-process "" nil "mpc" "prev"))) - ([XF86AudioNext] . - (lambda () - (interactive) - (start-process "" nil "mpc" "next"))) - ([XF86MonBrightnessDown] . - (lambda () - (interactive) - (start-process "" nil "light" "-U" "5"))) - ([XF86MonBrightnessUp] . - (lambda () - (interactive) - (start-process "" nil "light" "-A" "5"))) - ([XF86ScreenSaver] . - (lambda () - (interactive) - (start-process "" nil "dm-tool" "lock"))) - ([\s-XF86Back] . previous-buffer) - ([\s-XF86Forward] . next-buffer))) + (exwm-workspace-move-window ,i)))) + (number-sequence 0 (1- exwm-workspace-number))) + ([?\s-.] . exwm-floating-toggle-floating) + ([?\s-f] . exwm-layout-toggle-fullscreen) + ([?\s-W] . (lambda () + (interactive) + (kill-buffer (current-buffer)))) + ([?\s-Q] . (lambda () + (interactive) + (exwm-manage--kill-client))) + ([?\s-\'] . (lambda () + (interactive) + (start-process-shell-command + "dmneu-light" nil "dmenu-light"))) + ([?\s-\;] . (lambda () + (interactive) + (start-process-shell-command + "dmneu-pamixer" nil "dmenu-pamixer"))) + ([XF86AudioMute] . ; borken on my X200 :-( + (lambda () + (interactive) + (start-process "" nil "pamixer" "--toggle-mute"))) + ([XF86Launch1] . + (lambda () + (interactive) + (start-process "" nil "pamixer" "--toggle-mute"))) + ([\s-XF86Launch1] . ; toggle mic mute + (lambda () + (interactive) + (start-process + "" nil "pamixer" "--default-source" "--toggle-mute"))) + ([XF86AudioLowerVolume] . + (lambda () + (interactive) + (start-process + "" nil "pamixer" "--allow-boost" "--decrease" "5"))) + ([XF86AudioRaiseVolume] . + (lambda () + (interactive) + (start-process + "" nil "pamixer" "--allow-boost" "--increase" "5"))) + ([XF86AudioPlay] . + (lambda () + (interactive) + (start-process "" nil "mpc" "toggle"))) + ([XF86AudioPrev] . + (lambda () + (interactive) + (start-process "" nil "mpc" "prev"))) + ([XF86AudioNext] . + (lambda () + (interactive) + (start-process "" nil "mpc" "next"))) + ([XF86MonBrightnessDown] . + (lambda () + (interactive) + (start-process "" nil "light" "-U" "5"))) + ([XF86MonBrightnessUp] . + (lambda () + (interactive) + (start-process "" nil "light" "-A" "5"))) + ([XF86ScreenSaver] . + (lambda () + (interactive) + (start-process "" nil "dm-tool" "lock"))) + ([\s-XF86Back] . previous-buffer) + ([\s-XF86Forward] . next-buffer))) ;; Line-editing shortcuts -(csetq exwm-input-simulation-keys - '(;; movement - ([?\C-b] . [left]) - ([?\M-b] . [C-left]) - ([?\C-f] . [right]) - ([?\M-f] . [C-right]) - ([?\C-p] . [up]) - ([?\C-n] . [down]) - ([?\C-a] . [home]) - ([?\C-e] . [end]) - ([?\M-v] . [prior]) - ([?\C-v] . [next]) - ([?\C-d] . [delete]) - ([?\C-k] . [S-end ?\C-x]) - ([?\M-<] . C-home) - ([?\M->] . C-end) - ;; cut/copy/paste - ([?\C-w] . [?\C-x]) - ([?\M-w] . [?\C-c]) - ([?\C-y] . [?\C-v]) - ([?\M-d] . [C-S-right ?\C-x]) - ([?\M-\d] . [C-S-left ?\C-x]) - ;; window - ([?\s-w] . [?\C-w]) - ([?\s-q] . [?\C-q]) - ;; misc - ([?\C-s] . [?\C-f]) - ([?\s-s] . [?\C-s]) - ([?\C-g] . [escape]))) +(setq + exwm-input-simulation-keys + '(;; movement + ([?\C-b] . [left]) + ([?\M-b] . [C-left]) + ([?\C-f] . [right]) + ([?\M-f] . [C-right]) + ([?\C-p] . [up]) + ([?\C-n] . [down]) + ([?\C-a] . [home]) + ([?\C-e] . [end]) + ([?\M-v] . [prior]) + ([?\C-v] . [next]) + ([?\C-d] . [delete]) + ([?\C-k] . [S-end ?\C-x]) + ([?\M-<] . C-home) + ([?\M->] . C-end) + ;; cut/copy/paste + ([?\C-w] . [?\C-x]) + ([?\M-w] . [?\C-c]) + ([?\C-y] . [?\C-v]) + ([?\M-d] . [C-S-right ?\C-x]) + ([?\M-\d] . [C-S-left ?\C-x]) + ;; window + ([?\s-w] . [?\C-w]) + ([?\s-q] . [?\C-q]) + ;; misc + ([?\C-s] . [?\C-f]) + ([?\s-g] . [?\C-g]) + ([?\s-s] . [?\C-s]) + ([?\C-g] . [escape]) + ([?\C-/] . [?\C-z]))) (require 'exwm-manage) -(csetq +(setq exwm-manage-configurations '(((equal exwm-instance-name "floating") floating t @@ -277,7 +280,7 @@ around if needed." (exwm-input-set-local-simulation-keys `(,@exwm-input-simulation-keys ([?\C-\S-d] . [?\C-d])))) - ((member exwm-class-name '("URxvt" "Mate-terminal")) + ((member exwm-class-name '("XTerm" "Mate-terminal")) (exwm-input-set-local-simulation-keys '(([?\C-c ?\C-c] . [?\C-c]) ([?\C-c ?\C-u] . [?\C-u])))) @@ -287,7 +290,7 @@ around if needed." ([?\C-n] . [C-down])))))))) (require 'exwm-randr) -(csetq +(setq exwm-randr-workspace-monitor-plist '(0 "eDP-1" 1 "eDP-1" 2 "eDP-1" 3 "eDP-1" @@ -307,5 +310,19 @@ around if needed." (add-to-list 'load-path (b/lisp "exwm-edit")) (require 'exwm-edit) +(with-eval-after-load 'exwm-workspace + (setq exwm-workspace-show-all-buffers t) + (setq-default + mode-line-format + (append + mode-line-format + '((:eval + (format + " [%s]" (number-to-string + exwm-workspace-current-index))))))) + +(with-eval-after-load 'exwm-layout + (setq exwm-layout-show-all-buffers t)) + (provide 'bandali-exwm) ;;; bandali-exwm.el ends here