X-Git-Url: https://git.shemshak.org/~bandali/configs/blobdiff_plain/a5cf4300ad78adf0d1870cd4b01a83ee81b5151f..35684c66258108b87a21ff83ebd4c9bb34b224fd:/.emacs.d/init.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el index d889520..7635cf3 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -345,7 +345,7 @@ For disabling the behaviour for certain buffers and/or modes." ;; i don't need the default hint (initial-scratch-message nil) ;; use customizable text-mode as major mode for *scratch* - (initial-major-mode 'text-mode) + ;; (initial-major-mode 'text-mode) ;; inhibit buffer list when more than 2 files are loaded (inhibit-startup-buffer-menu t) ;; don't need to see the startup screen or echo area message @@ -513,22 +513,24 @@ For disabling the behaviour for certain buffers and/or modes." (bind-keys ;; for back and forward mouse keys + ("" . previous-buffer) ("" . previous-buffer) ("" . previous-buffer) + ("" . next-buffer) ("" . next-buffer) ("" . next-buffer) ("" . kill-this-buffer) ("" . ivy-switch-buffer)) (bind-keys - :prefix-map mab/straight-prefix-map + :prefix-map b/straight-prefix-map :prefix "C-c p s" ("u" . straight-use-package) ("f" . straight-freeze-versions) ("t" . straight-thaw-versions) ("P" . straight-prune-build) ("g" . straight-get-recipe) - ("r" . mab/reload-init) + ("r" . b/reload-init) ;; M-x ^straight-.*-all$ ("a c" . straight-check-all) ("a f" . straight-fetch-all) @@ -549,6 +551,176 @@ For disabling the behaviour for certain buffers and/or modes." ;;; Essential packages +(use-package exwm + :disabled + :demand + :config + (require 'exwm-config) + + ;; Set the initial workspace number. + (setq exwm-workspace-number 4) + + ;; Make class name the buffer name, truncating beyond 50 characters + (defun exwm-rename-buffer () + (interactive) + (exwm-workspace-rename-buffer + (concat exwm-class-name ":" + (if (<= (length exwm-title) 50) exwm-title + (concat (substring exwm-title 0 49) "..."))))) + (add-hook 'exwm-update-class-hook 'exwm-rename-buffer) + (add-hook 'exwm-update-title-hook 'exwm-rename-buffer) + + ;; 's-R': Reset + (exwm-input-set-key (kbd "s-R") #'exwm-reset) + ;; 's-\': Switch workspace + (exwm-input-set-key (kbd "s-\\") #'exwm-workspace-switch) + ;; 's-N': Switch to certain workspace + (dotimes (i 10) + (exwm-input-set-key + (kbd (format "s-%d" i)) + (lambda () + (interactive) + (exwm-workspace-switch-create i)))) + ;; 's-SPC': Launch application + ;; (exwm-input-set-key + ;; (kbd "s-SPC") + ;; (lambda (command) + ;; (interactive (list (read-shell-command "➜ "))) + ;; (start-process-shell-command command nil command))) + + (exwm-input-set-key (kbd "M-s-SPC") #'counsel-linux-app) + + ;; Shorten 'C-c C-q' to 'C-q' + (define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key) + + ;; Line-editing shortcuts + (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 delete]) + ;; cut/copy/paste + ;; ([?\C-w] . [?\C-x]) + ([?\M-w] . [?\C-c]) + ([?\C-y] . [?\C-v]) + ;; search + ([?\C-s] . [?\C-f]))) + + ;; Enable EXWM + (exwm-enable) + + (add-hook 'exwm-init-hook #'exwm-config--fix/ido-buffer-window-other-frame) + + (require 'exwm-systemtray) + (exwm-systemtray-enable) + + (require 'exwm-randr) + (exwm-randr-enable) + + ;; (exwm-input-set-key + ;; (kbd "s-") + ;; (lambda () + ;; (interactive) + ;; (start-process "urxvt" nil "urxvt"))) + + ;; (exwm-input-set-key + ;; (kbd "s-SPC") ;; rofi doesn't properly launch programs when started from emacs + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "rofi-run" nil "rofi -show run -display-run '> ' -display-window ' 🗔 '"))) + + ;; (exwm-input-set-key + ;; (kbd "s-/") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "rofi-win" nil "rofi -show window -display-run '> ' -display-window ' 🗔 '"))) + + ;; (exwm-input-set-key + ;; (kbd "M-SPC") + ;; (lambda () + ;; (interactive) + ;; (start-process "rofi-pass" nil "rofi-pass"))) + + ;; (exwm-input-set-key + ;; (kbd "") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "pamixer" nil "pamixer --toggle-mute"))) + + ;; (exwm-input-set-key + ;; (kbd "") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "pamixer" nil "pamixer --allow-boost --decrease 5"))) + + ;; (exwm-input-set-key + ;; (kbd "") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "pamixer" nil "pamixer --allow-boost --increase 5"))) + + ;; (exwm-input-set-key + ;; (kbd "") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "mpc" nil "mpc toggle"))) + + ;; (exwm-input-set-key + ;; (kbd "") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "mpc" nil "mpc prev"))) + + ;; (exwm-input-set-key + ;; (kbd "") + ;; (lambda () + ;; (interactive) + ;; (start-process-shell-command "mpc" nil "mpv next"))) + + (defun b/exwm-pasystray () + "A command used to start pasystray." + (interactive) + (if (executable-find "pasystray") + (progn + (message "EXWM: starting pasystray ...") + (start-process-shell-command "pasystray" nil "pasystray --notify=all")) + (message "EXWM: pasystray is not installed, abort!"))) + + (add-hook 'exwm-init-hook #'b/exwm-pasystray) + + (exwm-input-set-key + (kbd "s-t") + (lambda () + (interactive) + (exwm-floating-toggle-floating))) + + (exwm-input-set-key + (kbd "s-f") + (lambda () + (interactive) + (exwm-layout-toggle-fullscreen))) + + (exwm-input-set-key + (kbd "s-w") + (lambda () + (interactive) + (kill-buffer (current-buffer)))) + + (exwm-input-set-key + (kbd "s-q") + (lambda () + (interactive) + (exwm-manage--kill-client)))) + ;; use the org-plus-contrib package to get the whole deal (use-package org-plus-contrib) @@ -1309,7 +1481,7 @@ This function is intended for use with `ivy-ignore-buffers'." "Go dark." (interactive) (mapc #'disable-theme custom-enabled-themes) - ;; (load-theme 'doom-tomorrow-night t) + (load-theme 'doom-tomorrow-night t) (sml/apply-theme 'automatic) (font-lock-add-keywords 'org-mode b/org-mode-font-lock-keywords t)) @@ -1364,7 +1536,7 @@ This function is intended for use with `ivy-ignore-buffers'." ;; prefixes for major modes (which-key-add-major-mode-key-based-replacements 'message-mode - "C-c f" "footnote") + "C-c f n" "footnote") (which-key-add-major-mode-key-based-replacements 'org-mode "C-c C-v" "org-babel") (which-key-add-major-mode-key-based-replacements 'web-mode @@ -1665,9 +1837,13 @@ This function is intended for use with `ivy-ignore-buffers'." (use-package pdf-tools :defer 0.5 :bind (:map pdf-view-mode-map - ("" . pdf-history-backward) - ("" . pdf-history-forward) - ("M-RET" . image-previous-line)) + ("" . pdf-history-backward) + ("" . pdf-history-backward) + ("" . pdf-history-backward) + ("" . pdf-history-forward) + ("" . pdf-history-forward) + ("" . pdf-history-forward) + ("M-RET" . image-previous-line)) :config (pdf-tools-install nil t) :custom (pdf-view-resize-factor 1.05)) @@ -1967,7 +2143,11 @@ This function is intended for use with `ivy-ignore-buffers'." (bind-keys :map gnus-summary-mode-map ("M-L" . org-store-link)) - :hook (gnus-summary-mode . b/no-mouse-autoselect-window)) + :hook (gnus-summary-mode . b/no-mouse-autoselect-window) + :custom + (gnus-thread-sort-functions '(gnus-thread-sort-by-number + gnus-thread-sort-by-subject + gnus-thread-sort-by-date))) (use-feature gnus-msg :config @@ -2112,7 +2292,7 @@ https://csclub.uwaterloo.ca/~abandali") :bind (:map message-mode-map :prefix-map b/footnote-prefix-map - :prefix "C-c f" + :prefix "C-c f n" ("a" . footnote-add-footnote) ("b" . footnote-back-to-message) ("c" . footnote-cycle-style) @@ -2144,13 +2324,7 @@ https://csclub.uwaterloo.ca/~abandali") (use-feature ebdb-gnus :after ebdb :custom - (ebdb-gnus-window-configuration - '(article - (vertical 1.0 - (summary 0.25 point) - (horizontal 1.0 - (article 1.0) - (ebdb-gnus 0.3)))))) + (ebdb-gnus-window-size 0.3)) (use-feature ebdb-mua :after ebdb @@ -2191,6 +2365,8 @@ https://csclub.uwaterloo.ca/~abandali") :demand :load-path "lisp/" :config + ;; note: be sure to customize faces with `:foreground "white"' when + ;; using a theme with a white/light background :) (setq ft/gnus-article-patch-conditions '("^@@ -[0-9]+,[0-9]+ \\+[0-9]+,[0-9]+ @@")))