X-Git-Url: https://git.shemshak.org/~bandali/configs/blobdiff_plain/ca79fa96a8ff32996afe678089f446d57bf85260..35684c66258108b87a21ff83ebd4c9bb34b224fd:/.emacs.d/init.el diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 8f98696..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,8 +513,10 @@ 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) @@ -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) @@ -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)) @@ -2148,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 @@ -2195,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]+ @@")))