Useful navigation functions for EXWM and discord rich presence

This commit is contained in:
Curt Spark 2021-03-02 19:03:01 +00:00
parent ac7b78e415
commit fbf01cba5d
2 changed files with 87 additions and 22 deletions

View File

@ -53,6 +53,14 @@ Add hook to enable display-line-numbers-mode on all programming major modes:
#+BEGIN_SRC emacs-lisp
(add-hook 'prog-mode-hook 'display-line-numbers-mode)
#+END_SRC
*** Window Gaps/Dividers
Window Dividers/Gaps for windows, you can also use the mouse to resize the windows within the gaps.
Set window divider mode to true:
#+BEGIN_SRC emacs-lisp
(window-divider-mode 1)
#+END_SRC
*** Modern Fringes
Modern Fringes is a package that makes the side fringes of Emacs much more cleaner and modern.
Install the package, enable it and ensure that it always is installed:
@ -79,21 +87,21 @@ Old theme for if you'd like to follow Xresources
:config
;; Global settings (defaults)
(setq doom-themes-enable-bold t ; if nil, bold is universally disabled
doom-themes-enable-italic t) ; if nil, italics is universally disabled
doom-themes-enable-italic t)) ; if nil, italics is universally disabled
(load-theme 'doom-gruvbox t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
(load-theme 'doom-gruvbox t)
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config))
;; Enable custom neotree theme (all-the-icons must be installed!)
(doom-themes-neotree-config)
;; or for treemacs users
(setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
(doom-themes-treemacs-config)
;; Corrects (and improves) org-mode's native fontification.
(doom-themes-org-config)
#+END_SRC
*** Custom Modeline
A custom sleek modeline which is also used in Centaur Emacs, Doom Emacs and Spacemacs.
@ -107,7 +115,10 @@ Install and set the modeline, ensuring that it is always installed:
:init (doom-modeline-mode 1))
;; Display the current time on the modeline
(display-time 1)
(display-time-mode 1)
;; Display the battery (if has one) on the modeline
(display-battery-mode 1)
#+END_SRC
*** All The Icons
All The Icons is a package to display cool icons within Emacs.
@ -323,9 +334,15 @@ it.
Install the package, enable it and ensure that it always is installed:
#+BEGIN_SRC emacs-lisp
(use-package pdf-tools
:ensure t
:hook (pdf-tools-enabled . pdf-view-midnight-minor-mode)
;;:hook (pdf-tools-enabled . hide-mode-line-mode)
:init
(pdf-loader-install))
(pdf-loader-install)
:config
;; Set color of PDF foreground/background
(setq pdf-view-midnight-colors '("#ebdbb2" . "#282828")))
;; Doom-One F:#ABB2BF B:#282C35
;; Doom-Gruvbox F:#ebdbb2 B:#282828
#+END_SRC
** Org Mode
@ -560,6 +577,16 @@ Install the package, enable it and ensure that it always is installed, and then
:bind
("C-c e" . 'er/expand-region))
#+END_SRC
** Discord Rich Presence
Rich Presence in Emacs for discord, `https://github.com/Mstrodl/elcord`
Install the package, enable it and ensure that it always is installed, and then enable the mode:
#+BEGIN_SRC emacs-lisp
(use-package elcord
:ensure t
:init
(elcord-mode 1))
#+END_SRC
** LSP Mode
LSP mode will give you IDE capabilities in Emacs, using Microsoft's
Universal Language Server Protocol. The same one that VSCode uses for
@ -629,6 +656,31 @@ Install the package, enable it and ensure that it always is installed, and then
;; Mouse input/bindings
(require 'exwm-input)
(defun exwm-switch-workspace-left ()
"Switch one workspace to the left"
(interactive)
(if (= exwm-workspace-current-index 0) (exwm-workspace-switch 9) (exwm-workspace-switch (- exwm-workspace-current-index 1)))
(message (concat "Switched to workspace " (number-to-string exwm-workspace-current-index) "!")))
(defun exwm-switch-workspace-right ()
"Switch one workspace to the right"
(interactive)
(if (= exwm-workspace-current-index 9) (exwm-workspace-switch 0) (exwm-workspace-switch (+ exwm-workspace-current-index 1)))
(message (concat "Switched to workspace " (number-to-string exwm-workspace-current-index) "!")))
(defun exwm-swap-workspace-left ()
"Swap current workspace with the workspace to the left"
(interactive)
(if (= exwm-workspace-current-index 0) (exwm-workspace-swap exwm-workspace--current (exwm-workspace--workspace-from-frame-or-index 9)) (exwm-workspace-swap exwm-workspace--current (exwm-workspace--workspace-from-frame-or-index (- exwm-workspace-current-index 1))))
(message (concat "Swapped current workspace with workspace " (number-to-string exwm-workspace-current-index) "!")))
(defun exwm-swap-workspace-right ()
"Swap current workspace with the workspace to the right"
(interactive)
(if (= exwm-workspace-current-index 9) (exwm-workspace-swap exwm-workspace--current (exwm-workspace--workspace-from-frame-or-index 0)) (exwm-workspace-swap exwm-workspace--current (exwm-workspace--workspace-from-frame-or-index (+ exwm-workspace-current-index 1))) )
(message (concat "Swapped current workspace with workspace " (number-to-string exwm-workspace-current-index) "!")))
;; Keybindings
(setq exwm-input-global-keys
`(;; Reset EXWM
@ -648,13 +700,26 @@ Install the package, enable it and ensure that it always is installed, and then
;; Char mode allows for practically all keybindings to be passed to the application aside from a few essential keybindings, line mode allows for emacs keybindings
([?\s-i] . exwm-input-toggle-keyboard)
;; Application Launcher
([?\s-d] . counsel-linux-app)))
;; Switch one workspace to the left
([?\s-h] . exwm-switch-workspace-left)
;; Set all windows to open in char mode by default, allowing to pass through all key combinations
;; (add-hook 'exwm-manage-finish-hook
;; (lambda () (call-interactively #'exwm-input-release-keyboard)
;; (exwm-layout-hide-mode-line)))
;; Switch one workspace to the right
([?\s-l] . exwm-switch-workspace-right)
;; Swap current workspace with one workspace to the left
([?\s-H] . exwm-swap-workspace-left)
;; Swap current workspace with one workspace to the left
([?\s-L] . exwm-swap-workspace-right)
;; Application Launcher
([?\s-b] . counsel-linux-app)))
;; Set all X windows to open in char mode by default, allowing to pass through all key combinations
(add-hook 'exwm-manage-finish-hook
(lambda () (call-interactively #'exwm-input-release-keyboard)
;;(exwm-layout-hide-mode-line)
))
;; Ido mode seems to be enabled in the default configuration, turn it back off as we are using Ivy completion instead.
(ido-mode -1)

View File

@ -1 +1 @@
("~/.emacs.d/" "~/.emacs.d/elpa/xelb-0.18/")
("~/.emacs.d/")