From b99be3cc901bad25e988f2cbaa4192ce6b858afd Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 6 Jul 2024 21:45:31 -0500 Subject: Update for like, exwm stuff --- emacs | 9 +++++---- emacs.d/early-init.el | 2 +- exwm | 43 ++++++++++++++++++++++++++----------------- 3 files changed, 32 insertions(+), 22 deletions(-) diff --git a/emacs b/emacs index 5066268..26e5bbb 100644 --- a/emacs +++ b/emacs @@ -19,7 +19,7 @@ (set-file-modes user-private-file #o600)) (load user-private-file :no-error) -(load-theme 'brianna :no-confirm) ; see ~/.emacs.d/brianna-theme.el +(load-theme 'bob :no-confirm) ; see ~/.emacs.d/bob-theme.el (add-hook 'after-init-hook #'setup-faces) (define-advice startup-echo-area-message (:override ()) @@ -495,8 +495,8 @@ (locate-user-emacs-file "early-init.el")) "c" (find-user-file custom custom-file) "p" (find-user-file private) - "t" (find-user-file brianna - (locate-user-emacs-file "brianna-theme.el")) + "t" (find-user-file bob + (locate-user-emacs-file "bob-theme.el")) "x" (find-user-file exwm (expand-file-name "~/.exwm")) "s" #'scratch-buffer)) @@ -641,7 +641,7 @@ (^turn-off 'display-fill-column-indicator-mode)) (add-hook 'prog-mode-hook #'auto-fill-mode) (add-hook 'prog-mode-hook #'electric-pair-local-mode) -(add-to-list 'warning-suppress-types 'comp) +(setopt warning-suppress-types '(comp)) (context-menu-mode) (delete-selection-mode) (global-goto-address-mode) @@ -767,6 +767,7 @@ (setopt eshell-history-size nil) (keymap-global-set "C-z" #'popup-eshell) +(keymap-global-set "C-c C-z" #'popup-eshell) (add-hook 'eshell-first-time-mode-hook (defun @eshell-once () (keymap-set eshell-mode-map "C-z" #'quit-window))) diff --git a/emacs.d/early-init.el b/emacs.d/early-init.el index b2de2f2..bbf9464 100644 --- a/emacs.d/early-init.el +++ b/emacs.d/early-init.el @@ -7,7 +7,7 @@ (setopt default-frame-alist '((menu-bar-lines . 0) (tool-bar-lines . 0) - (vertical-scroll-bars) + ;;(vertical-scroll-bars) (horizontal-scroll-bars))) (when (getenv "IN_EXWM") diff --git a/exwm b/exwm index 0b52846..08d410f 100644 --- a/exwm +++ b/exwm @@ -15,6 +15,17 @@ (start-process-shell-command (format " %s" command) " *autostart*" command)) +(defun run-or-raise (command &optional buffer-name) + "Raise BUFFER-NAME if it exists, else run COMMAND. +BUFFER-NAME defaults to the first word of COMMAND." + (let ((buffer-name (or buffer-name (car (string-split command))))) + (if (buffer-live-p (get-buffer buffer-name)) + (switch-to-buffer buffer-name) + (exwm-spawn command)))) + +(defun ^run-or-raise (command) + (lambda () (interactive) (run-or-raise command))) + ;; Wifi info (defun dBm->perc (dBm) (truncate (+ (- (/ (* dBm dBm) 105.0)) @@ -84,6 +95,11 @@ (setopt display-time-format "%e %a %R") (setopt battery-mode-line-format "[🔋%b%p%]") +(display-wifi-info-mode) +(display-battery-mode) +(display-time-mode) + +;; Must come after the above (setopt global-mode-string '("" jabber-activity-mode-string display-wifi-info-string @@ -91,10 +107,6 @@ " " (:propertize ("" display-time-string) face tab-bar-tab))) -(display-wifi-info-mode) -(display-battery-mode) -(display-time-mode) - ;;; Window management (after exwm-update-class-hook @@ -104,21 +116,15 @@ (setopt exwm-input-global-keys `(;; Command shortcuts - ([?\s-p] . ,(^exwm-spawn "keepassxc")) - ([?\s-b] . ,(^exwm-spawn "firefox --new-tab")) + ([?\s-p] . ,(^run-or-raise "keepassxc")) + ([?\s-b] . ,(^run-or-raise "firefox")) ;; 's-r': Reset (to line-mode). ([?\s-r] . exwm-reset) - ;; 's-w': Switch workspace. - ([?\s-w] . exwm-workspace-switch) + ;; 's-w': Bury buffer (I honestly don't really use workspaces) + ([?\s-w] . bury-buffer) + ([?\s-o] . other-window-dwim) ;; 's-&': Launch application. - ([?\s-&] . exwm-spawn) - ;; 's-N': Switch to certain workspace. - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%d" i)) . - (lambda () - (interactive) - (exwm-workspace-switch-create ,i)))) - (number-sequence 1 9)))) + ([?\s-&] . exwm-spawn))) (setopt exwm-input-simulation-keys '(([?\C-b] . [left]) @@ -130,7 +136,10 @@ ([?\M-v] . [prior]) ([?\C-v] . [next]) ([?\C-d] . [delete]) - ([?\C-k] . [S-end delete]))) + ([?\C-k] . [S-end delete]) + ([?\M-w] . [?\C-c]) + ([?\C-w] . [?\C-x]) + ([?\C-y] . [?\C-v]))) ;;; Startup -- cgit 1.4.1-21-gabe81