docs: typos
All checks were successful
deploy / build (push) Successful in 3m41s

This commit is contained in:
2023-12-10 15:09:07 +01:00
parent dbf3c5e212
commit 3354f79554
26 changed files with 509 additions and 962 deletions

View File

@@ -9,365 +9,6 @@
Many settings formerly present in this websites index are related to
my desktop settings, while some others are not.
# Also, since I switched to StumpWM, many of my keybinds from Emacs need
# to be kept up to date with my StumpWM keybinds, and /vice versa/. This
# document aims to regroup all settings related to the desktop in order
# to have an easier time managing them.
** Common Emacs and StumpWM settings :noexport:
Both Emacs and StumpWM work on the same principle of keychords
powering a function or command. With both of them I have a prefix key,
~SPC~ in the case of Emacs (or ~C-SPC~ when in insert-mode, see the
relevant config) and ~s-SPC~ in the case of StumpWM. That means I can
give them the same keychord following this, for instance ~w/~ to create
a new vertically split frame to the right of the current one.
All the keybinds will be presented in the form of tables, with on the
first column the keychord following the leader key, on the second
column the EmacsLisp function to be called, and on the third the
StumpWM command. If one of the ELisp or StumpWM cases is empty, it
means there is no equivalence. If its ~nil~, then it means it is a
prefix key. The fourth column is for now reserved for Emacs
which-key, so I can give it a better name. If its value is ~nil~, then
it should not show up. Hopefully this can be implemented someday in
StumpWM.
*** Generating Code :noexport:
**** Elisp
#+name: emacs-keybinds-gen
#+header: :var keymap=emacs-stumpwm-media-control
#+begin_src emacs-lisp :exports none :tangle no :wrap "src emacs-lisp :tangle no"
(mapconcat (lambda (keybind)
(let* ((keychord (replace-regexp-in-string (rx (or (seq line-start "~")
(seq "~" line-end)))
""
(car keybind)))
(function (replace-regexp-in-string (rx (or (seq line-start "~")
(seq "~" line-end)))
""
(nth 1 keybind)))
(which (nth 3 keybind)))
(format "\"%s\" %s"
keychord
(if (string= "nil" function)
(format "%S"
`(:ignore :which-key ,which))
(if (string= "" which)
(concat "#'" function)
(format "%S"
`'(,(intern function) :which-key ,which)))))))
(seq-filter (lambda (elem)
(not (string= "" (nth 1 elem))))
keymap)
"\n")
#+end_src
#+RESULTS: emacs-keybinds-gen
#+begin_src emacs-lisp :tangle no
"m" (:ignore :which-key "media")
"" #'emms-player-mpd-previous
"" #'emms-player-mpd-next
"ma" '(hydra-media/body :which-key "MPD add")
"mb" (:ignore :which-key "browse")
"mba" #'emms-browse-by-artist
"mbA" #'emms-browse-by-album
"mbg" #'emms-browse-by-genre
"mbp" #'emms-playlists-mode-go
"mbs" #'emms-smart-browse
"mby" #'emms-browse-by-year
"mc" #'emms-player-mpd-clear
"mp" #'emms-player-toggle-pause
"ms" #'emms-player-mpd-show
"mu" (:ignore :which-key "update")
"mum" #'emms-player-mpd-update-all
"muc" #'emms-cache-set-from-mpd-all
#+end_src
#+name: emacs-hydra-keybinds-gen
#+header: :var keymap=emacs-stumpwm-resize-frame
#+begin_src emacs-lisp :exports none :tangle no :wrap "src emacs-lisp :tangle no"
(mapconcat (lambda (keybind)
(let ((keychord (replace-regexp-in-string "^~\\|~$"
""
(car keybind)))
(function (replace-regexp-in-string "^~\\|~$"
""
(nth 1 keybind)))
(which (nth 3 keybind)))
(format "%S" (if (string= "" which)
`(,keychord ,(intern function))
`(,keychord ,(intern function) ,which)))))
keymap
"\n")
#+end_src
#+RESULTS: emacs-hydra-keybinds-gen
#+begin_src emacs-lisp :tangle no
("c" shrink-window-horizontally)
("t" enlarge-window)
("s" shrink-window)
("r" enlarge-window-horizontally)
#+end_src
**** Lisp
#+name: stumpwm-filter-keybinds
#+begin_src emacs-lisp :exports none :tangle no
(let ((no-tilde (lambda (string)
(replace-regexp-in-string "^~\\|~$" "" string))))
(seq-filter (lambda (elem)
(= 1 (length (car elem))))
(mapcar (lambda (elem)
`(,(replace-regexp-in-string (format "^%s" prefix) "" (car elem))
.
,(cdr elem)))
(seq-filter (lambda (elem)
(and (not (string= "" (cdr elem)))
(not (string= prefix (car elem)))
(string-prefix-p prefix (car elem))))
(mapcar (lambda (elem)
(let ((keychord (apply no-tilde (list (car elem))))
(function (apply no-tilde (list (nth 2 elem)))))
`(,keychord . ,function)))
keymap)))))
#+end_src
#+name: stumpwm-keybinds-gen
#+header: :var keymap=emacs-stumpwm-media-control keymap-name="my-mpd-add-map" prefix="m"
#+begin_src emacs-lisp :exports none :tangle no :wrap "src lisp :tangle no" :noweb yes
(require 'seq)
(format "(defvar *%s*
(let %S
%s
m))"
keymap-name
`((m (make-sparse-keymap)))
(mapconcat (lambda (keybind)
(let ((keychord (replace-regexp-in-string (format "^%s" prefix)
""
(car keybind)))
(function (cdr keybind)))
(format "%S" `(define-key m (kbd ,keychord) ,function))))
<<stumpwm-filter-keybinds>>
"\n "))
#+end_src
#+RESULTS: stumpwm-keybinds-gen
#+begin_src lisp :tangle no
(defvar *my-mpd-add-map*
(let ((m (make-sparse-keymap)))
(define-key m (kbd ".") "media-interactive")
(define-key m (kbd "«") "mpd-prev")
(define-key m (kbd "»") "mpd-next")
(define-key m (kbd "a") "'*my-mpd-add-keymap*")
(define-key m (kbd "b") "'*my-mpd-browse-keymap*")
(define-key m (kbd "c") "mpd-clear")
(define-key m (kbd "p") "mpd-toggle-pause")
m))
#+end_src
#+name: stumpwm-interactive-keybinds-gen
#+header: :var keymap=emacs-stumpwm-resize-frame prefix=""
#+header: :wrap "src lisp :exports none"
#+begin_src emacs-lisp :noweb yes
(format "(%s)"
(mapconcat (lambda (keybind)
(let ((keychord (car keybind))
(function (cdr keybind)))
(format "%S" `((kbd ,keychord) ,function))))
<<stumpwm-filter-keybinds>>
"\n "))
#+end_src
#+RESULTS: stumpwm-interactive-keybinds-gen
#+begin_src lisp :exports none
(((kbd "c") "resize-direction left")
((kbd "t") "resize-direction down")
((kbd "s") "resize-direction up")
((kbd "r") "resize-direction right"))
#+end_src
#+name: stumpwm-interactive-gen
#+header: :var keymap=emacs-stumpwm-resize-frame keymap-name="my-mpd-add-map" prefix=""
#+begin_src emacs-lisp :exports none :tangle no :wrap "src lisp :tangle no"
(format "%S"
`(define-interactive-keymap ,(intern keymap-name)
(:exit-on '((kbd "RET")
(kbd "ESC")
(kbd "C-g")
(kbd "q")))
,@
<<stumpwm-interactive-keybinds-gen>>
))
#+end_src
#+RESULTS: stumpwm-interactive-gen
#+begin_src lisp :tangle no
(define-interactive-keymap my-mpd-add-map (:exit-on '((kbd "RET") (kbd "ESC") (kbd "C-g") (kbd "q"))) ((kbd "c") "resize-direction left" (kbd "t") "resize-direction down" (kbd "s") "resize-direction up" (kbd "r") "resize-direction right"))
#+end_src
*** Frames Management
In StumpWM, Ill consider my various windows the same as Emacs
buffers.
#+name: emacs-stumpwm-frames-management
| Keychord | Emacs | StumpWM | which-key |
|----------+---------------------------+-------------------------+-----------|
| ~b~ | ~nil~ | ~'*my-buffers-keymap*~ | buffers |
| ~bb~ | ~buflers-switch-buffer~ | ~windowlist~ | |
| ~bB~ | ~bury-buffer~ | | |
| ~bd~ | ~kill-this-buffer~ | ~delete-window~ | |
| ~bD~ | ~kill-buffer~ | ~window-window-and-frame~ | |
| ~bh~ | ~dashboard-refresh-buffer~ | | |
| ~bk~ | | ~kill-window~ | |
| ~bl~ | ~bufler~ | | |
| ~bm~ | ~switch-to-messages-buffer~ | | |
| ~bn~ | ~evil-next-buffer~ | ~next~ | |
| ~bp~ | ~evil-prev-buffer~ | ~prev~ | |
| ~br~ | ~counsel-buffer-or-recentf~ | | |
| ~bs~ | ~switch-to-scratch-buffer~ | | |
EmacsLisp code:
#+begin_src emacs-lisp
(phundrak/leader-key
<<emacs-keybinds-gen(keymap=emacs-stumpwm-frames-management)>>
)
#+end_src
StumpWMs Lisp code:
#+begin_src lisp
<<stumpwm-keybinds-gen(keymap=emacs-stumpwm-frames-management, keymap-name="my-buffers-keymap", prefix="b")>>
(define-key *root-map (kbd "b") '*my-buffers-keymap*)
#+end_src
*** Window Management
The following allows to have an interactive keymap for resizing the
current frame. In Emacs, it will be translated as a hydra while in
StumpWM it will be an interactive keymap.
#+name: emacs-stumpwm-resize-frame
| Keychord | Emacs | StumpWM | which-key |
|----------+-----------------------------+------------------------+-----------|
| ~c~ | ~shrink-window-horizontally~ | ~resize-direction left~ | |
| ~t~ | ~enlarge-window~ | ~resize-direction down~ | |
| ~s~ | ~shrink-window~ | ~resize-direction up~ | |
| ~r~ | ~enlarge-window-horizontally~ | ~resize-direction right~ | |
This translates into the following hydra in EmacsLisp:
#+begin_src emacs-lisp
(defhydra windows-adjust-size ()
"
^Zoom^ ^Other
^^^^^^^-----------------------------------------
[_t_/_s_] shrink/enlarge vertically [_q_] quit
[_c_/_r_] shrink/enlarge horizontally
"
<<emacs-hydra-keybinds-gen(keymap=emacs-stumpwm-resize-frame)>>
("q" nil :exit t))
#+end_src
While the following Lisp code is used with StumpWM.
#+begin_src lisp
(define-interactive-keymap (iresize tile-group) (:on-enter #'setup-iresize
:on-exit #'resize-unhide
:abort-if #'abort-resize-p
:exit-on '((kbd "RET")
(kbd "ESC")
(kbd "C-g")
(kbd "q")))
<<stumpwm-interactive-keybinds-gen(keymap=emacs-stumpwm-resize-frame)>>
)
#+end_src
Below you will find my window management keybinds.
#+name: emacs-stump-window-management
| Keychord | Emacs | StumpWM | which-key |
|----------+-------------------------------+--------------------------+------------------|
| ~w~ | ~nil~ | ~'*my-windows-keymap*~ | windows |
| ~w.~ | ~windows-adjust-size/body~ | ~iresize~ | resize windows |
| ~w-~ | ~split-window-below-and-focus~ | ~vsplit-and-focus~ | |
| ~w+~ | | ~balance-frames~ | |
| ~wv~ | ~split-window-below~ | ~vsplit~ | |
| ~wV~ | | ~vsplit-equally~ | |
| ~w/~ | ~split-window-right-and-focus~ | ~hsplit-and-focus~ | |
| ~wh~ | ~split-window-right~ | ~hsplit~ | |
| ~wH~ | | ~hsplit-equally~ | |
| ~wc~ | ~evil-window-left~ | ~move-focus left~ | |
| ~wt~ | ~evil-window-down~ | ~move-focus down~ | |
| ~ws~ | ~evil-window-up~ | ~move-focus up~ | |
| ~wr~ | ~evil-window-right~ | ~move-focus right~ | |
| ~wC~ | | ~move-window left~ | |
| ~wT~ | | ~move-window down~ | |
| ~wS~ | | ~move-window up~ | |
| ~wR~ | | ~move-window right~ | |
| ~w C-c~ | | ~exchange-direction right~ | |
| ~w C-s~ | | ~exchange-direction down~ | |
| ~w C-t~ | | ~exchange-direction up~ | |
| ~w C-r~ | | ~exchange-direction right~ | |
| ~wb~ | ~kill-buffer-and-delete-window~ | | |
| ~we~ | ~winum-select-window-by-number~ | ~expose~ | |
| ~wf~ | | ~fullscreen~ | |
| ~wF~ | | ~'*my-floating-keymap*~ | floating windows |
| ~wFf~ | | ~float-this~ | |
| ~wFF~ | | ~flatten-floats~ | |
| ~wFu~ | | ~unfloat-this~ | |
| ~wi~ | | ~info~ | |
| ~wd~ | ~delete-window~ | ~remove-split~ | |
| ~wD~ | ~delete-other-windows~ | ~only~ | |
| ~wm~ | | ~meta~ | |
| ~wo~ | ~other-window~ | ~other-window~ | |
| ~ws~ | | ~sibling~ | |
| ~wu~ | | ~next-urgent~ | |
| ~wU~ | | ~unmaximize~ | |
| ~ww~ | ~nil~ | | writeroom |
| ~ww.~ | ~writeroom-buffer-width/body~ | | |
| ~www~ | ~writeroom-mode~ | | |
*** Media Control
#+name: emacs-stumpwm-media-interactive
| Keychord | Emacs | StumpWM | which-key |
|----------+-------------------------------------------------------------+-----------------+-----------|
| ~c~ | ~emms-player-mpd-previous~ | ~mpd-prev~ | |
| ~t~ | ~(shell-command-and-echo "mpc volume -2" "mpc volume" "mpc")~ | ~mpd-volume-down~ | |
| ~s~ | ~(shell-command-and-echo "mpc volume +2" "mpc volume" "mpc")~ | ~mpd-volume-up~ | |
| ~r~ | ~emms-player-mpd-next~ | ~mpd-next~ | |
| ~s~ | ~emms-player-mpd-stop~ | ~mpd-stop~ | |
#+name: emacs-stumpwm-general-media
| Keychord | Emacs | StumpWM | which-key |
|----------+-------+--------------------------------------+----------------|
| ~c~ | | ~exec xbacklight -dec 2~ | backlight down |
| ~t~ | | ~exec amixer -q set Master 2%- unmute~ | volume down |
| ~s~ | | ~exec amixer -q set Master 2%+ unmute~ | volume up |
| ~r~ | | ~exec xbacklight -inc 2~ | backlight up |
| ~m~ | | ~exec amixer -q set Master 1+ toggle~ | toggle mute |
#+name: emacs-stumpwm-media-control
| Keychord | Emacs | StumpWM | which-key |
|----------+-----------------------------+---------------------------+-----------|
| ~m~ | ~nil~ | ~'*my-media-keymap*~ | media |
| ~m.~ | | ~media-interactive~ | |
| ~m«~ | ~emms-player-mpd-previous~ | ~mpd-prev~ | |
| ~m»~ | ~emms-player-mpd-next~ | ~mpd-next~ | |
| ~ma~ | ~hydra-media/body~ | ~'*my-mpd-add-keymap*~ | MPD add |
| ~maa~ | | ~mpd-serach-and-add-artist~ | |
| ~maA~ | | ~mpd-serach-and-add-album~ | |
| ~maf~ | | ~mpd-search-and-add-file~ | |
| ~maF~ | | ~mpd-add-file~ | |
| ~mag~ | | ~mpd-search-and-add-genre~ | |
| ~mat~ | | ~mpd-search-and-add-title~ | |
| ~mb~ | ~nil~ | ~'*my-mpd-browse-keymap*~ | browse |
| ~mba~ | ~emms-browse-by-artist~ | ~mpd-browse-artists~ | |
| ~mbA~ | ~emms-browse-by-album~ | ~mpd-browse-albums~ | |
| ~mbg~ | ~emms-browse-by-genre~ | ~mpd-browse-genres~ | |
| ~mbp~ | ~emms-playlists-mode-go~ | ~mpd-browse-playlist~ | |
| ~mbs~ | ~emms-smart-browse~ | | |
| ~mbt~ | | ~mpd-browse-tracks~ | |
| ~mby~ | ~emms-browse-by-year~ | | |
| ~mc~ | ~emms-player-mpd-clear~ | ~mpd-clear~ | |
| ~mp~ | ~emms-player-toggle-pause~ | ~mpd-toggle-pause~ | |
| ~ms~ | ~emms-player-mpd-show~ | | |
| ~mu~ | ~nil~ | | update |
| ~mum~ | ~emms-player-mpd-update-all~ | | |
| ~muc~ | ~emms-cache-set-from-mpd-all~ | | |
** Theme and graphical tweaks
*** GTK Settings
**** GTK2
@@ -407,8 +48,8 @@ gtk-menu-popup-delay=0
[Filechooser Settings]
#+END_SRC
The first option alows me to open the file chooser in the current working
directory:
The first option allows me to open the file chooser in the current
working directory:
#+BEGIN_SRC conf-unix
StartupMode=cwd
#+END_SRC
@@ -513,7 +154,8 @@ gtk-decoration-layout=
:HEADER-ARGS: :mkdirp yes :tangle ~/.config/X11/Xresources :exports code
:END:
The main body in my Xresources declaration is the declaration of my
color theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from their [[https://github.com/arcticicestudio/nord-xresources/][Git repository]].
colour theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from their [[https://github.com/arcticicestudio/nord-xresources/][Git
repository]].
#+BEGIN_SRC conf
#define nord0 #2E3440
#define nord1 #3B4252