diff options
author | bd <bdunahu@gmail.com> | 2023-12-30 22:06:34 -0700 |
---|---|---|
committer | bd <bdunahu@gmail.com> | 2023-12-30 22:06:34 -0700 |
commit | cd470a45060e2ebe292dc35ba84f2f503b1c3504 (patch) | |
tree | 3bbd9ec415c83a7a6325dea81e67a20fc5af6508 /.config/emacs | |
parent | d32d588ecb00b11a1dfda3880b4d66cd5b38a33d (diff) |
Many quality-of-life changes to EXWM, some modeline changes.
Diffstat (limited to '.config/emacs')
-rw-r--r-- | .config/emacs/bd-emms.el | 1 | ||||
-rw-r--r-- | .config/emacs/bd-mode-and-themes.el | 73 | ||||
-rw-r--r-- | .config/emacs/bd-wm.el | 54 | ||||
-rw-r--r-- | .config/emacs/bookmarks | 8 | ||||
-rw-r--r-- | .config/emacs/init.el | 11 |
5 files changed, 89 insertions, 58 deletions
diff --git a/.config/emacs/bd-emms.el b/.config/emacs/bd-emms.el index cf39f94..1204d17 100644 --- a/.config/emacs/bd-emms.el +++ b/.config/emacs/bd-emms.el @@ -25,6 +25,7 @@ playback." (emms-next)) (use-package emms + :defer 4 ;; need to load immediately for mode line :bind (("C-z C-m" . 'emms-open-playlist-buffer)) :config diff --git a/.config/emacs/bd-mode-and-themes.el b/.config/emacs/bd-mode-and-themes.el index dbab69a..7cdc196 100644 --- a/.config/emacs/bd-mode-and-themes.el +++ b/.config/emacs/bd-mode-and-themes.el @@ -8,46 +8,46 @@ ;;;; icon components for filename and git status (use-package all-the-icons :init - (progn (progn (defun modeline-buffer-name () - "Return 'buffer-name' with proper spacing and icon." - (format " %s %s" (all-the-icons-icon-for-file (buffer-name)) (buffer-name))) - (defvar-local bd/buffer-identification-mode-line - '(:eval (format "%s" (modeline-buffer-name))) - "Formats the modeline-buffer-name.")) - - (progn (defun git-vc-modeline () - (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-"))) - (concat - (propertize (format " %s" (all-the-icons-octicon "git-branch")) - 'face `(:height 1 :family ,(all-the-icons-octicon-family)) - 'display '(raise 0)) - (propertize (format " %s" branch)) - (propertize " ")))) - (defvar-local bd/vc-mode-line - '(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; temp fix to avoid bug which occurs in magit buffer - (format "%s" - (propertize (git-vc-modeline) 'face 'shadow)))) - "Formats the checked out git repository."))) + (defun modeline-buffer-name () + "Return 'buffer-name' with proper spacing and icon." + (format " %s %s" (all-the-icons-icon-for-file (buffer-name)) (buffer-name))) + (defvar-local bd/buffer-identification-mode-line + '(:eval (format "%s" (modeline-buffer-name))) + "Formats the modeline-buffer-name.") + + (defun git-vc-modeline () + (let ((branch (mapconcat 'concat (cdr (split-string vc-mode "[:-]")) "-"))) + (concat + (propertize (format " %s" (all-the-icons-octicon "git-branch")) + 'face `(:height 1 :family ,(all-the-icons-octicon-family)) + 'display '(raise 0)) + (propertize (format " %s" branch)) + (propertize " ")))) + (defvar-local bd/vc-mode-line + '(:eval (when (and vc-mode (not (eq major-mode 'magit-status-mode))) ; temp fix to avoid bug which occurs in magit buffer + (format "%s" + (propertize (git-vc-modeline) 'face 'shadow)))) + "Formats the checked out git repository.") :config (setq emms-mode-line-icon-before-format (format "%s" (all-the-icons-fileicon "owl")) emms-mode-line-icon-enabled-p t)) (use-package ednc :init - (progn (defun stack-notifications (&optional hide) - "Return active notifications as a string, one -per application." - (mapconcat (lambda (notification - (let ((app-name (ednc-notification-app-name notification))) - (unless (member app-name hide) - (push app-name hide) - (end-format-notification notification))) - (ednc-notifications) ""))))) + (defun get-num-notifications () + "Return number of active notifcations as a string." + (format "%s" (length (ednc-notifications)))) + (defvar-local bd/notify-mode-line + '(:eval (when (and (ednc-notifications) (mode-line-window-selected-p)) + (format " %s %s" (all-the-icons-material "notifications_active") + (propertize (get-num-notifications) 'face 'error)))) + "Formats the notification number.") :config - (ednc-mode) - (nconc global-mode-string '((:eval (stack-notifications)))) - (add-hook 'ednc-notification-presentation-functions - (lambda (&rest _) (force-mode-line-update t)))) + (ednc-mode)) + +(defun test () + (when (ednc-notifications) + (message "nice"))) ;;;; time and date (setq display-time-format "%m/%d/%y %H:%M (%a)" @@ -71,9 +71,7 @@ only in the selected buffer.") 'display `((space :align-to (- (+ right right-fringe right-margin) ,reserve))))) ;;;; pad out space for time (this method is probably horrendous) -(insert-into-list global-mode-string (mode-line-fill 30) (cl-position 'display-time-string global-mode-string)) - - ; 21 +(insert-into-list global-mode-string (mode-line-fill 21) (cl-position 'display-time-string global-mode-string)) (dolist (construct '(bd/buffer-identification-mode-line bd/vc-mode-line @@ -91,6 +89,7 @@ only in the selected buffer.") " " ;; mode-line-position mode-line-modified + bd/notify-mode-line bd/vc-mode-line " " bd/misc-mode-line @@ -127,7 +126,7 @@ only in the selected buffer.") ;;;; true transparency ;; (add-to-list 'default-frame-alist '(alpha-background . 60)) -(set-frame-parameter (selected-frame) 'alpha '(72 . 72)) +(add-to-list 'default-frame-alist '(alpha . (72 . 72))) (defun set-frame-alpha (value) "Sets the transparency of the frame background. 0=transparent/100=opaque" diff --git a/.config/emacs/bd-wm.el b/.config/emacs/bd-wm.el index 515f9c8..328faac 100644 --- a/.config/emacs/bd-wm.el +++ b/.config/emacs/bd-wm.el @@ -1,14 +1,30 @@ ;; -*- lexical-binding: t; -*- +(winner-mode 1) + (defun bd/exwm-update-class () "Changes the buffer name to reflect the class name for that buffer." (exwm-workspace-rename-buffer exwm-class-name)) -(winner-mode 1) +(defun bd/exwm-init-hook () + "Make workspace 1 the default startup workspace." + (exwm-workspace-switch-create 1)) + +(defun toggle-current-window-dedication () + "Adds or revokes dedicated window status from a buffer. A +dedicated buffer will never be automatically orphaned." + (interactive) + (let* ((window (selected-window)) + (dedicated (window-dedicated-p window))) + (set-window-dedicated-p window (not dedicated)) + (message "Window %sdedicated to %s" + (if dedicated "no longer " "") + (buffer-name)))) (use-package exwm :config + (add-hook 'exwm-init-hook #'bd/exwm-init-hook) (add-hook 'exwm-update-class-hook #'bd/exwm-update-class) ;; order is important (require 'exwm-randr) @@ -42,7 +58,7 @@ that buffer." (exwm-enable) (server-start) :custom - (exwm-workspace-number 10) + (exwm-workspace-number 10) ; puts scratch buffer everywhere (exwm-input-prefix-keys '(?\C-x ?\C-u @@ -56,20 +72,40 @@ that buffer." (exwm-input-global-keys `(([?\s-n] . other-window) ([?\s-p] . (lambda () - (interactive) - (other-window -1))) + (interactive) + (other-window -1))) ([?\s-r] . exwm-reset) + ([?\s-d] . toggle-current-window-dedication) ([?\s-q] . kill-current-buffer) ;; ([?\s-<f10>] . emms-pause) ; see rest of mpc commands above--mpc pause performed poorly ([?\s-x] . (lambda (command) (interactive (list (read-shell-command "s-x "))) (start-process-shell-command command nil command))) - ,@(mapcar (lambda (i) - `(,(kbd (format "s-%s" (car i))) . + `(,(kbd (format "s-%d" i)) . (lambda () - (interactive - (exwm-workspace-switch-create ,(car (cdr i))))))) - '((! 0) (@ 1) (\# 2) ($ 3) (% 4) (^ 5) (& 6) (* 7) (\( 8) (\) 9))))) + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) + (exwm-input-simulation-keys + '(([?\C-b] . [left]) + ([?\C-f] . [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 delete]))) + + ;; ,@(mapcar (lambda (i) + ;; `(,(kbd (format "s-%s" (car i))) . + ;; (lambda () + ;; (interactive + ;; (exwm-workspace-switch-create ,(car (cdr i))))))) + ;; '((! 0) (@ 1) (\# 2) ($ 3) (% 4) (^ 5) (& 6) (* 7) (\( 8) (\) 9))))) + (exwm-workspace-show-all-buffers t) + (exwm-layout-show-all-buffers t) (exwm-randr-workspace-monitor-plist '(0 "DVI-D-1" 2 "DVI-D-1" 4 "DVI-D-1" 6 "DVI-D-1" 8 "DVI-D-1"))) diff --git a/.config/emacs/bookmarks b/.config/emacs/bookmarks index 9a905cb..72d8115 100644 --- a/.config/emacs/bookmarks +++ b/.config/emacs/bookmarks @@ -2,7 +2,13 @@ ;;; This format is meant to be slightly human-readable; ;;; nevertheless, you probably don't want to edit it. ;;; -*- End Of Bookmark File Format Version Stamp -*- -(("emacs-dired" +(("org-capture-last-stored" + (filename . "~/Personal/roam/agenda/agenda_tasks.org") + (front-context-string . "** TODO Fix paus") + (rear-context-string . "ox\n\n* Unsorted\n\n") + (position . 917) + (last-modified 26000 61282 867384 301000)) +("emacs-dired" (filename . "~/.config/emacs/") (front-context-string . "auto-save-list\n ") (rear-context-string . "0K Dec 22 22:30 ") diff --git a/.config/emacs/init.el b/.config/emacs/init.el index b06bde0..79416e6 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -31,17 +31,6 @@ "Returns non-nil if NAME matches the name of an existing buffer" (try-completion name (mapcar #'buffer-name (buffer-list)))) -(defun toggle-current-window-dedication () - "Adds or revokes dedicated window status from a buffer. A -dedicated buffer will never be automatically orphaned." - (interactive) - (let* ((window (selected-window)) - (dedicated (window-dedicated-p window))) - (set-window-dedicated-p window (not dedicated)) - (message "Window %sdedicated to %s" - (if dedicated "no longer " "") - (buffer-name)))) - (defun rip-video () "If region, open SEARCH with mpv in --full-screen. Else, open URL at point." |