diff --git a/.config/emacs/desktop.org b/.config/emacs/desktop.org index cc58dd6..183c61b 100644 --- a/.config/emacs/desktop.org +++ b/.config/emacs/desktop.org @@ -15,7 +15,7 @@ DesktopNames=exwm #+begin_src shell #!/bin/sh # Fire it up for WSL - source ~/scripts/wsl_get_display.sh + #source ~/scripts/wsl_get_display.sh picom -b --config $HOME/.xmonad/scripts/picom.conf & exec dbus-launch --exit-with-session emacs -mm --debug-init -l ~/.config/emacs/desktop.el #+end_src @@ -68,108 +68,104 @@ DesktopNames=exwm (exwm-floating-move (- pos-x) (- pos-y)))) (use-package exwm - :ensure t) + :config + ;; Set the default number of workspaces + (setq exwm-workspace-number 10) - ;;(use-package exwm - ;; :config - ;; ;; Set the default number of workspaces - ;; (setq exwm-workspace-number 10) + ;; When window "class" updates, use it to set the buffer name + (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) - ;; ;; When window "class" updates, use it to set the buffer name - ;; (add-hook 'exwm-update-class-hook #'efs/exwm-update-class) + ;; When window title updates, use it to set the buffer name + (add-hook 'exwm-update-title-hook #'efs/exwm-update-title) - ;; ;; When window title updates, use it to set the buffer name - ;; (add-hook 'exwm-update-title-hook #'efs/exwm-update-title) + ;; Configure windows as they're created + ;;(add-hook 'exwm-manage-finish-hook #'efs/configure-window-by-class) - ;; ;; Configure windows as they're created - ;; ;;(add-hook 'exwm-manage-finish-hook #'efs/configure-window-by-class) + ;; When EXWM starts up, do some extra confifuration + (add-hook 'exwm-init-hook #'efs/exwm-init-hook) - ;; ;; When EXWM starts up, do some extra confifuration - ;; (add-hook 'exwm-init-hook #'efs/exwm-init-hook) + ;; Automatically send the mouse cursor to the selected workspace's display + (setq exwm-workspace-warp-cursor t) - ;; ;; Automatically send the mouse cursor to the selected workspace's display - ;; (setq exwm-workspace-warp-cursor t) + ;; Window focus should follow the mouse pointer + (setq mouse-autoselect-window t + focus-follows-mouse t) - ;; ;; Window focus should follow the mouse pointer - ;; (setq mouse-autoselect-window t - ;; focus-follows-mouse t) + (add-hook 'exwm-floating-setup-hook + (lambda () + (exwm-layout-hide-mode-line))) - ;; (add-hook 'exwm-floating-setup-hook - ;; (lambda () - ;; (exwm-layout-hide-mode-line))) + ;; These keys should always pass through to Emacs + (setq exwm-input-prefix-keys + '(?\C-x + ?\C-u + ?\C-h + ?\M-x + ?\M-` + ?\M-& + ?\M-: + ?\C-\M-j ;; Buffer list + ?\C-\ )) ;; Ctrl+Space - ;; ;; These keys should always pass through to Emacs - ;; (setq exwm-input-prefix-keys - ;; '(?\C-x - ;; ?\C-u - ;; ?\C-h - ;; ?\M-x - ;; ?\M-` - ;; ?\M-& - ;; ?\M-: - ;; ?\C-\M-j ;; Buffer list - ;; ?\C-\ )) ;; Ctrl+Space + ;; Ctrl+Q will enable the next key to be sent directly + (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) - ;; ;; Ctrl+Q will enable the next key to be sent directly - ;; (define-key exwm-mode-map [?\C-q] 'exwm-input-send-next-key) + ;; Set up global key bindings. These always work, no matter the input state! + ;; Keep in mind that changing this list after EXWM initializes has no effect. + (setq exwm-input-global-keys + `( + ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) + ([?\s-r] . exwm-reset) - ;; ;; Set up global key bindings. These always work, no matter the input state! - ;; ;; Keep in mind that changing this list after EXWM initializes has no effect. - ;; (setq exwm-input-global-keys - ;; `( - ;; ;; Reset to line-mode (C-c C-k switches to char-mode via exwm-input-release-keyboard) - ;; ([?\s-r] . exwm-reset) + ;; Move between windows + ([?\s-h] . windmove-left) + ([?\s-l] . windmove-right) + ([?\s-k] . windmove-up) + ([?\s-j] . windmove-down) - ;; ;; Move between windows - ;; ([?\s-h] . windmove-left) - ;; ([?\s-l] . windmove-right) - ;; ([?\s-k] . windmove-up) - ;; ([?\s-j] . windmove-down) + ;;([s-space] . toggle-frame-fullscreen) + ([?\s-f] . exwm-floating-toggle-floating) - ;; ;;([s-space] . toggle-frame-fullscreen) - ;; ([?\s-f] . exwm-floating-toggle-floating) + ;; Launch applications via shell command + ([?\s-&] . (lambda (command) + (interactive (list (read-shell-command "$ "))) + (start-process-shell-command command nil command))) - ;; ;; Launch applications via shell command - ;; ([?\s-&] . (lambda (command) - ;; (interactive (list (read-shell-command "$ "))) - ;; (start-process-shell-command command nil command))) + ([?\s-C] . (lambda () (interactive) (kill-buffer))) - ;; ([?\s-C] . (lambda () (interactive) (kill-buffer))) + ;; App + (,(kbd "") . vifon/exwm-terminal) + (,(kbd "") . app-launcher-run-app) + ;; Switch workspace + ([?\s-w] . exwm-workspace-switch) + ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) - ;; ;; App - ;; (,(kbd "") . vifon/exwm-terminal) - ;; (,(kbd "") . app-launcher-run-app) - ;; ;; Switch workspace - ;; ([?\s-w] . exwm-workspace-switch) - ;; ([?\s-`] . (lambda () (interactive) (exwm-workspace-switch-create 0))) + ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) + ,@(mapcar (lambda (i) + `(,(kbd (format "s-%d" i)) . + (lambda () + (interactive) + (exwm-workspace-switch-create ,i)))) + (number-sequence 0 9)))) - ;; ;; 's-N': Switch to certain workspace with Super (Win) plus a number key (0 - 9) - ;; ,@(mapcar (lambda (i) - ;; `(,(kbd (format "s-%d" i)) . - ;; (lambda () - ;; (interactive) - ;; (exwm-workspace-switch-create ,i)))) - ;; (number-sequence 0 9)))) + (exwm-enable)) - ;; (exwm-enable)) - - ;; if not wsl - ;;(use-package desktop-environment - ;; :after exwm - ;; :config (desktop-environment-mode) - ;; :custom - ;; (desktop-environment-brightness-small-increment "2%+") - ;; (desktop-environment-brightness-small-decrement "2%-") - ;; (desktop-environment-brightness-normal-increment "5%+") - ;; (desktop-environment-brightness-normal-decrement "5%-")) + if not wsl + (use-package desktop-environment + :after exwm + :config (desktop-environment-mode) + :custom + (desktop-environment-brightness-small-increment "2%+") + (desktop-environment-brightness-small-decrement "2%-") + (desktop-environment-brightness-normal-increment "5%+") + (desktop-environment-brightness-normal-decrement "5%-")) ;; Make sure the server is started (better to do this in your main Emacs config!) (server-start) #+end_src ** Polybar -#+begin_src emacs-lisp - ;;:tangle ~/.config/emacs/desktop.el +#+begin_src emacs-lisp :tangle ~/.config/emacs/desktop.el (defvar efs/polybar-process nil "Holds the process of the running Polybar instance, if any") diff --git a/.config/emacs/emacs.org b/.config/emacs/emacs.org index ee331f1..2a9d002 100755 --- a/.config/emacs/emacs.org +++ b/.config/emacs/emacs.org @@ -214,6 +214,7 @@ Emacs Configuration for emacs 29.50 (require 'custom-keybindings) (require 'custom-default) (require 'custom-completion) + (require 'custom-edit) (require 'custom-projects) (require 'custom-latex) (require 'custom-org) @@ -405,48 +406,48 @@ emacs built-in package config #+end_src **** Setting Transparency ***** emacs 28 -#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el - (set-frame-parameter (selected-frame) 'alpha '(85 . 50)) - (add-to-list 'default-frame-alist '(alpha . '(85 . 50))) - (defun toggle-transparency () - (interactive) - (let ((alpha (frame-parameter nil 'alpha))) - (set-frame-parameter - nil 'alpha - (if (eql (cond ((numberp alpha) alpha) - ((numberp (cdr alpha)) (cdr alpha)) - ;; Also handle undocumented ( ) form. - ((numberp (cadr alpha)) (cadr alpha))) - 100) - '(85 . 50) '(100 . 100))))) - (defun my/transparency-round (val) - "Round VAL to the nearest tenth of an integer." - (/ (round (* 10 val)) 10.0)) +#+begin_src emacs-lisp :mkdirp yes +;;:tangle ~/.config/emacs/modules/custom-ui.el + (set-frame-parameter (selected-frame) 'alpha '(85 . 50)) + (add-to-list 'default-frame-alist '(alpha . '(85 . 50))) + (defun toggle-transparency () + (interactive) + (let ((alpha (frame-parameter nil 'alpha))) + (set-frame-parameter + nil 'alpha + (if (eql (cond ((numberp alpha) alpha) + ((numberp (cdr alpha)) (cdr alpha)) + ;; Also handle undocumented ( ) form. + ((numberp (cadr alpha)) (cadr alpha))) + 100) + '(85 . 50) '(100 . 100))))) + (defun my/transparency-round (val) + "Round VAL to the nearest tenth of an integer." + (/ (round (* 10 val)) 10.0)) - (defun my/increase-frame-alpha-background () - "Increase current frame’s alpha background." - (interactive) - (set-frame-parameter nil - 'alpha-background - (my/transparency-round - (min 1.0 - (+ (frame-parameter nil 'alpha-background) 0.1)))) - (message "%s" (frame-parameter nil 'alpha-background))) + (defun my/increase-frame-alpha-background () + "Increase current frame’s alpha background." + (interactive) + (set-frame-parameter nil + 'alpha-background + (my/transparency-round + (min 1.0 + (+ (frame-parameter nil 'alpha-background) 0.1)))) + (message "%s" (frame-parameter nil 'alpha-background))) - (defun my/decrease-frame-alpha-background () - "Decrease current frame’s alpha background." - (interactive) - (set-frame-parameter nil - 'alpha-background - (my/transparency-round - (max 0.0 - (- (frame-parameter nil 'alpha-background) 0.1)))) - (message "%s" (frame-parameter nil 'alpha-background))) - (global-set-key (kbd "C-c t") 'toggle-transparency) + (defun my/decrease-frame-alpha-background () + "Decrease current frame’s alpha background." + (interactive) + (set-frame-parameter nil + 'alpha-background + (my/transparency-round + (max 0.0 + (- (frame-parameter nil 'alpha-background) 0.1)))) + (message "%s" (frame-parameter nil 'alpha-background))) + (global-set-key (kbd "C-c t") 'toggle-transparency) #+end_src ***** emacs 29 -#+begin_src emacs-lisp - ;;:mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el +#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-ui.el (set-frame-parameter nil 'alpha-background 0.9) (add-to-list 'default-frame-alist '(alpha-background . 0.9)) (defun toggle-transparency () @@ -907,6 +908,58 @@ Quick Action in minibuffer (provide 'custom-completion) ;;; custom-completion.el ends here #+end_src +*** Edit +**** Helpful +#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-edit.el + (use-package helpful + :defer t + :custom + (counsel-describe-function-function #'helpful-callable) + (counsel-describe-variable-function #'helpful-variable)) + ;;:commands (helpful-callable helpful-variable helpful-command helpful-key) + (global-set-key [remap describe-function] #'describe-function) + (global-set-key [remap describe-command] #'helpful-command) + (global-set-key [remap describe-variable] #'describe-variable) + (global-set-key [remap describe-key] #'helpful-key) +#+end_src +**** Avy +#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-edit.el + (use-package avy + :defer t + :config + (setq avy-all-windows t)) + (ju/leader-key-def + "v" '(:ignore t :which-key "Avy") + "vc" '(avy-goto-char :which-key "Avy Goto Char") + "vw" '(avy-goto-word-0 :which-key "Avy Goto Word") + "vl" '(avy-goto-line :which-key "Avy Goto Line")) +#+end_src +**** Snippet +#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-edit.el + (use-package yasnippet + :defer t + :hook (prog-mode . yas-minor-mode) + :config + (defvar yas-snippet-dirs nil) + (add-to-list 'yas-snippet-dirs "~/.config/emacs/snippets") + (yas-global-mode 1)) + (ju/leader-key-def + "i s" '(yas-insert-snippet :which-key "snippet")) +#+end_src +**** Emojify +#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-edit.el + (use-package emojify + :defer t + :init (global-emojify-mode 1)) + (ju/leader-key-def + "i e" '(emojify-insert-emoji :which-key "emoji")) +#+end_src +**** Provide Modules +#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-edit.el +(provide 'custom-edit) +;;; custom-completion.el ends here +#+end_src + *** Org Mode **** Normal Function ***** configure org @@ -1542,51 +1595,6 @@ speed-up insertion of environments and math templates. ;;; custom-latex.el ends here #+end_src *** Extra -**** Helpful -#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el - (use-package helpful - :defer t - :custom - (counsel-describe-function-function #'helpful-callable) - (counsel-describe-variable-function #'helpful-variable)) - ;;:commands (helpful-callable helpful-variable helpful-command helpful-key) - (global-set-key [remap describe-function] #'describe-function) - (global-set-key [remap describe-command] #'helpful-command) - (global-set-key [remap describe-variable] #'describe-variable) - (global-set-key [remap describe-key] #'helpful-key) -#+end_src -**** Avy -#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el - (use-package avy - :defer t - :config - (setq avy-all-windows t)) - (ju/leader-key-def - "v" '(:ignore t :which-key "Avy") - "vc" '(avy-goto-char :which-key "Avy Goto Char") - "vw" '(avy-goto-word-0 :which-key "Avy Goto Word") - "vl" '(avy-goto-line :which-key "Avy Goto Line")) -#+end_src -**** Snippet -#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el - (use-package yasnippet - :defer t - :hook (prog-mode . yas-minor-mode) - :config - (defvar yas-snippet-dirs nil) - (add-to-list 'yas-snippet-dirs "~/.config/emacs/snippets") - (yas-global-mode 1)) - (ju/leader-key-def - "i s" '(yas-insert-snippet :which-key "snippet")) -#+end_src -**** Emojify -#+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el - (use-package emojify - :defer t - :init (global-emojify-mode 1)) - (ju/leader-key-def - "i e" '(emojify-insert-emoji :which-key "emoji")) -#+end_src **** PDF Tool enhanced PDF viewer on emacs #+begin_src emacs-lisp :mkdirp yes :tangle ~/.config/emacs/modules/custom-extra.el