Compare commits
4 Commits
17034d3d9d
...
c4c80945e8
Author | SHA1 | Date |
---|---|---|
Lucien Cartier-Tilet | c4c80945e8 | |
Lucien Cartier-Tilet | 7b0833252a | |
Lucien Cartier-Tilet | 00ee413240 | |
Lucien Cartier-Tilet | 47d63fedb4 |
|
@ -195,7 +195,7 @@ set with a valid OpenAI key.
|
|||
# If the user passes '-h', '--help', or 'help' print out a little bit of help.
|
||||
# text.
|
||||
case "$1" in
|
||||
"-h" | "--help" | "help")
|
||||
"-h" | "--help" | "help")
|
||||
printf 'Generate kaomojis on request.\n\n'
|
||||
printf 'Usage: %s [kind]\n' "$(basename "$0")"
|
||||
exit 1
|
||||
|
@ -206,13 +206,13 @@ esac
|
|||
# kind of Kaomoji produced.
|
||||
sentiment=""
|
||||
if [[ $1 != "" ]]; then
|
||||
sentiment=" $1"
|
||||
sentiment=" $1"
|
||||
fi
|
||||
|
||||
# Ask mods to generate Kaomojis. Save the output in a variable.
|
||||
kaomoji="$(mods "generate 10${sentiment} kaomojis. number them and put each one on its own line.")"
|
||||
if [[ $kaomoji == "" ]]; then
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Pipe mods output to gum so the user can choose the perfect kaomoji. Save that
|
||||
|
@ -220,13 +220,13 @@ fi
|
|||
# in front of the Kaomoji.
|
||||
choice="$(echo "$kaomoji" | gum choose | cut -d ' ' -f 2)"
|
||||
if [[ $choice == "" ]]; then
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If the current session is Wayland, copy with wl-copy, otherwise copy with xclipboard
|
||||
if [ "$XDG_SESSION_TYPE" = "wayland" ]
|
||||
then printf '%s' "$choice" | wc-copy # X11
|
||||
else printf '%s' "$choice" | xclip -sel clip # Wayland
|
||||
then printf '%s' "$choice" | wc-copy # Wayland
|
||||
else printf '%s' "$choice" | xclip -sel clip # X11
|
||||
fi
|
||||
|
||||
# We're done!
|
||||
|
|
|
@ -1796,16 +1796,17 @@ configuration for the ~mu4e~ package itself.
|
|||
:straight (:build t)
|
||||
:commands mu4e mu4e-compose-new
|
||||
:init
|
||||
|
||||
(defun mu4e--main-action-str (name func)
|
||||
"This seems to be needed until evil-collection supports the latest
|
||||
version of mu4e."
|
||||
"mu4e-main-action")
|
||||
|
||||
(require 'mu4e)
|
||||
|
||||
(remove-hook 'mu4e-main-mode-hook 'evil-collection-mu4e-update-main-view)
|
||||
|
||||
<<mu4e-ical-setup>>
|
||||
<<mu4e-ical-init-config>>
|
||||
|
||||
(csetq mu4e-completing-read-function 'completing-read
|
||||
mu4e-use-fancy-chars t
|
||||
message-kill-buffer-on-exit t
|
||||
|
@ -1830,6 +1831,7 @@ configuration for the ~mu4e~ package itself.
|
|||
(add-hook 'mu4e-view-mode-hook (lambda () (setq truncate-lines nil)))
|
||||
(add-hook 'mu4e-headers-mode-hook (lambda () (setq truncate-lines t)))
|
||||
|
||||
<<mu4e-ical-config>>
|
||||
<<mu4e-keybindings-undef>>
|
||||
<<mu4e-keybindings-view>>
|
||||
<<mu4e-keybindings-view-no-prefix>>
|
||||
|
@ -1911,6 +1913,34 @@ StartupWMClass=Gnus
|
|||
Keywords=Text;Editor;
|
||||
#+end_src
|
||||
|
||||
***** Interact with iCalendar events
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: PackagesConfigurationApplicationsEmailMu4eInteractwithiCalendarevents-dmsenkt0xuj0
|
||||
:END:
|
||||
Something that has always bugged me was how to properly with iCalendar
|
||||
events shared with me on my personal mailbox. The answer is actually
|
||||
[[https://www.djcbsoftware.nl/code/mu/mu4e/iCalendar.html][dead simple]].
|
||||
#+name: mu4e-ical-setup
|
||||
#+begin_src emacs-lisp
|
||||
(require 'mu4e-icalendar)
|
||||
(mu4e-icalendar-setup)
|
||||
#+end_src
|
||||
|
||||
I’ll just configure a couple of things regarding these events, namely
|
||||
converting them to Orgmode and add them to my =~/org/notes.org= file,
|
||||
and delete the email once I answered to the event.
|
||||
#+name: mu4e-ical-config
|
||||
#+begin_src emacs-lisp
|
||||
(setq mu4e-icalendar-trash-after-reply t)
|
||||
#+end_src
|
||||
|
||||
#+name: mu4e-ical-init-config
|
||||
#+begin_src emacs-lisp
|
||||
(setq gnus-icalendar-org-capture-file "~/org/notes.org"
|
||||
gnus-icalendar-org-capture-headline '("Calendar"))
|
||||
(gnus-icalendar-org-setup)
|
||||
#+end_src
|
||||
|
||||
***** Basic configuration
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Packages-Configuration-Applications-Email-Mu4e-Basic-configurationfxy0fl6184j0
|
||||
|
@ -5679,7 +5709,9 @@ The project is then defined like so:
|
|||
(phundrak/major-leader-key
|
||||
:keymaps 'org-mode-map
|
||||
:pakages 'org-ref
|
||||
"ic" #'org-ref-insert-link))
|
||||
"ic" #'org-ref-insert-link
|
||||
"ir" #'org-ref-insert-link-hydra/body
|
||||
"iB" #'org-ref-bibtex-hydra/body))
|
||||
#+end_src
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
|
@ -8348,6 +8380,11 @@ and builds a heatmap out of it.
|
|||
:config
|
||||
(setq mastodon-instance-url "https://emacs.ch"
|
||||
mastodon-active-user "phundrak")
|
||||
|
||||
(defun me/mastodon-toot--send-language-if-none ()
|
||||
(unless mastodon-toot--language
|
||||
(mastodon-toot--set-toot-language)))
|
||||
(advice-add #'me/mastodon-toot--send-language-if-none :before #'mastodon-toot--send)
|
||||
:general
|
||||
(phundrak/evil
|
||||
:packages '(mastodon)
|
||||
|
|
|
@ -258,107 +258,6 @@ Finally, we can notify the user everything is ready.
|
|||
|
||||
And it’s done! We can now move on to the creation of the other CLisp files.
|
||||
|
||||
* Commands
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Commands-1wagy001v5j0
|
||||
:header-args:lisp: :mkdirp yes :tangle ~/.stumpwm.d/commands.lisp
|
||||
:END:
|
||||
The first command I declare in this file is a command that will avoid
|
||||
me invoking too many Firefox instances. Either Firefox is not already
|
||||
running and an instance is launched, or one already is and we are
|
||||
brought to it. This is done like so:
|
||||
#+begin_src lisp
|
||||
(defcommand firefox () ()
|
||||
"Run or raise Firefox."
|
||||
(sb-thread:make-thread (lambda () (run-or-raise "firefox" '(:class "Firefox") t nil))))
|
||||
#+end_src
|
||||
|
||||
Next, this command will not only close the current window, but it will
|
||||
also close the current frame.
|
||||
#+begin_src lisp
|
||||
(defcommand delete-window-and-frame () ()
|
||||
"Delete the current frame with its window."
|
||||
(delete-window)
|
||||
(remove-split))
|
||||
#+end_src
|
||||
|
||||
The two following commands will create a new frame to the right and
|
||||
below the current frame respectively, then focus it.
|
||||
#+begin_src lisp
|
||||
(defcommand hsplit-and-focus () ()
|
||||
"Create a new frame on the right and focus it."
|
||||
(hsplit)
|
||||
(move-focus :right))
|
||||
|
||||
(defcommand vsplit-and-focus () ()
|
||||
"Create a new frame below and move focus to it."
|
||||
(vsplit)
|
||||
(move-focus :down))
|
||||
#+end_src
|
||||
|
||||
Now, let’s create a command for invoking the terminal, optionally with
|
||||
a program.
|
||||
#+begin_src lisp
|
||||
(defcommand term (&optional program) ()
|
||||
"Invoke a terminal, possibly with a @arg{program}."
|
||||
(sb-thread:make-thread
|
||||
(lambda ()
|
||||
(run-shell-command (if program
|
||||
(format nil "kitty ~A" program)
|
||||
"kitty")))))
|
||||
#+end_src
|
||||
|
||||
** At work
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: CommandsAtwork-6u8lkt51vsj0
|
||||
:END:
|
||||
When I’m at work, I have a desktop layout I always use. No need to
|
||||
describe it here, but I want a quick command to save my layout in case
|
||||
I change it a bit as well as a command to load it. That way, I can
|
||||
automatically organize my screens. These command will save and load
|
||||
the dump where the variable ~*my/desktop-dump-file*~ points at.
|
||||
#+begin_src lisp
|
||||
(defvar *my/desktop-dump-file* "~/.cache/stump-at-work"
|
||||
"Where my desktop dump should go and be loaded from.")
|
||||
#+end_src
|
||||
|
||||
To save the current desktop, I can write a wrapper around
|
||||
~dump-desktop-to-file~.
|
||||
#+begin_src lisp
|
||||
(defcommand dump-work () ()
|
||||
"Save desktop layout when at work."
|
||||
(dump-desktop-to-file *my/desktop-dump-file*))
|
||||
#+end_src
|
||||
|
||||
Basically the same goes for loading the desktop layout, but this time
|
||||
it’s ~restore-from-file~ that’s wrapped. I also want to launch Global
|
||||
Protect at the same time, because I always forget to before launching
|
||||
~launch-work~ described below, and automatically connect my bluetooth
|
||||
headset.
|
||||
#+begin_src lisp
|
||||
(defcommand at-work () ()
|
||||
"Restore desktop layout when at work."
|
||||
(restore-from-file *my/desktop-dump-file*)
|
||||
(run-shell-command "gpclient")
|
||||
(run-shell-command "bluetoothctl power on && bluetoothctl connect 14:3F:A6:6D:E3:D9"))
|
||||
#+end_src
|
||||
|
||||
If I want to quickly launch all programs I will need, I can also
|
||||
invoke the command ~launch-work~.
|
||||
#+begin_src lisp
|
||||
(defcommand launch-work () ()
|
||||
"Launch programs I need at work."
|
||||
(run-shell-command "autorandr -l work; xwallpaper --zoom (cat $HOME/.cache/wallpaper)" t)
|
||||
(run-shell-command "pkill picom")
|
||||
(run-shell-command "firefox")
|
||||
(run-shell-command "remmina")
|
||||
(run-shell-command "kitty btop")
|
||||
(run-shell-command "kitty")
|
||||
(run-shell-command "kitty ncmpcpp -qs clock")
|
||||
(run-shell-command "teams")
|
||||
(run-shell-command "discord"))
|
||||
#+end_src
|
||||
|
||||
* Colors
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Colors-w5493d01v5j0
|
||||
|
@ -939,6 +838,109 @@ Finally, let’s enable our gaps:
|
|||
(swm-gaps:toggle-gaps))
|
||||
#+end_src
|
||||
|
||||
* Commands
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Commands-1wagy001v5j0
|
||||
:header-args:lisp: :mkdirp yes :tangle ~/.stumpwm.d/commands.lisp
|
||||
:END:
|
||||
The first command I declare in this file is a command that will avoid
|
||||
me invoking too many Firefox instances. Either Firefox is not already
|
||||
running and an instance is launched, or one already is and we are
|
||||
brought to it. This is done like so:
|
||||
#+begin_src lisp
|
||||
(defcommand firefox () ()
|
||||
"Run or raise Firefox."
|
||||
(sb-thread:make-thread (lambda () (run-or-raise "firefox" '(:class "Firefox") t nil))))
|
||||
#+end_src
|
||||
|
||||
Next, this command will not only close the current window, but it will
|
||||
also close the current frame.
|
||||
#+begin_src lisp
|
||||
(defcommand delete-window-and-frame () ()
|
||||
"Delete the current frame with its window."
|
||||
(delete-window)
|
||||
(remove-split))
|
||||
#+end_src
|
||||
|
||||
The two following commands will create a new frame to the right and
|
||||
below the current frame respectively, then focus it.
|
||||
#+begin_src lisp
|
||||
(defcommand hsplit-and-focus () ()
|
||||
"Create a new frame on the right and focus it."
|
||||
(hsplit)
|
||||
(move-focus :right))
|
||||
|
||||
(defcommand vsplit-and-focus () ()
|
||||
"Create a new frame below and move focus to it."
|
||||
(vsplit)
|
||||
(move-focus :down))
|
||||
#+end_src
|
||||
|
||||
Now, let’s create a command for invoking the terminal, optionally with
|
||||
a program.
|
||||
#+begin_src lisp
|
||||
(defcommand term (&optional program) ()
|
||||
"Invoke a terminal, possibly with a @arg{program}."
|
||||
(sb-thread:make-thread
|
||||
(lambda ()
|
||||
(run-shell-command (if program
|
||||
(format nil "kitty ~A" program)
|
||||
"kitty")))))
|
||||
#+end_src
|
||||
|
||||
** At work
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: CommandsAtwork-6u8lkt51vsj0
|
||||
:END:
|
||||
When I’m at work, I have a desktop layout I always use. No need to
|
||||
describe it here, but I want a quick command to save my layout in case
|
||||
I change it a bit as well as a command to load it. That way, I can
|
||||
automatically organize my screens. These command will save and load
|
||||
the dump where the variable ~*my/desktop-dump-file*~ points at.
|
||||
#+begin_src lisp
|
||||
(defvar *my/desktop-dump-file* "~/.cache/stump-at-work"
|
||||
"Where my desktop dump should go and be loaded from.")
|
||||
#+end_src
|
||||
|
||||
To save the current desktop, I can write a wrapper around
|
||||
~dump-desktop-to-file~.
|
||||
#+begin_src lisp
|
||||
(defcommand dump-work () ()
|
||||
"Save desktop layout when at work."
|
||||
(dump-desktop-to-file *my/desktop-dump-file*))
|
||||
#+end_src
|
||||
|
||||
Basically the same goes for loading the desktop layout, but this time
|
||||
it’s ~restore-from-file~ that’s wrapped. I also want to launch Global
|
||||
Protect at the same time, because I always forget to before launching
|
||||
~launch-work~ described below, and automatically connect my bluetooth
|
||||
headset.
|
||||
#+begin_src lisp
|
||||
(load-module "swm-gaps")
|
||||
(defcommand at-work () ()
|
||||
"Restore desktop layout when at work."
|
||||
(swm-gaps:toggle-gaps-off)
|
||||
(run-shell-command "pkill picom" t)
|
||||
(run-shell-command "autorandr -l work" t)
|
||||
(run-shell-command "xwallpaper --zoom $(cat $HOME/.cache/wallpaper)" t)
|
||||
(run-shell-command "gpclient")
|
||||
(run-shell-command "bluetoothctl power on && bluetoothctl connect 14:3F:A6:6D:E3:D9"))
|
||||
#+end_src
|
||||
|
||||
If I want to quickly launch all programs I will need, I can also
|
||||
invoke the command ~launch-work~.
|
||||
#+begin_src lisp
|
||||
(defcommand launch-work () ()
|
||||
"Launch programs I need at work."
|
||||
(run-shell-command "firefox")
|
||||
(run-shell-command "remmina")
|
||||
(run-shell-command "kitty tmux")
|
||||
(run-shell-command "teams")
|
||||
(run-shell-command "discord")
|
||||
(restore-from-file *my/desktop-dump-file*)
|
||||
(restore-window-placement-rules "~/.cache/placement-rules"))
|
||||
#+end_src
|
||||
|
||||
* Keybinds
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Keybinds-c6wgf961v5j0
|
||||
|
|
|
@ -72,6 +72,7 @@ Here’s a list of the plugins that I use.
|
|||
| tmux-sensible | Better defaults I can’t be bothered to change myself |
|
||||
| tmux-yank | Better copy/pasting |
|
||||
| tmux-prefix-highlight | Tell me which prefix I’m using |
|
||||
| tmux-resurrect | Persist tmux sessions across system restarts |
|
||||
| nordtheme/tmux | Nord theme for Tmux! |
|
||||
|
||||
#+begin_src emacs-lisp :var plugins=plugins[,0] :exports code :wrap src tmux
|
||||
|
@ -90,6 +91,7 @@ set -g @plugin 'tmux-plugins/tpm'
|
|||
set -g @plugin 'tmux-plugins/tmux-sensible'
|
||||
set -g @plugin 'tmux-plugins/tmux-yank'
|
||||
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
|
||||
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
||||
set -g @plugin 'nordtheme/tmux'
|
||||
#+end_src
|
||||
|
||||
|
@ -98,6 +100,27 @@ Let’s run TPM right after that.
|
|||
run '~/.config/tmux/tpm/tpm'
|
||||
#+end_src
|
||||
|
||||
For restoring processes with =tmux-resurrect=, we must add additional
|
||||
programs in the =@resurrect-processes= variable. These are:
|
||||
#+name: resurrect-processes-list
|
||||
- ="~ncmpcpp -q"=
|
||||
- =btop=
|
||||
- =ssh=
|
||||
|
||||
#+name: resurrect-processes
|
||||
#+begin_src emacs-lisp :var processes=resurrect-processes-list :exports none :cache yes
|
||||
(mapconcat (lambda (process) (string-replace "=" "" process))
|
||||
processes
|
||||
" ")
|
||||
#+end_src
|
||||
|
||||
#+RESULTS[4f72312f2da98c81eff2b092779a59c993fa19e2]: resurrect-processes
|
||||
: "~ncmpcpp -q" btop ssh
|
||||
|
||||
#+begin_src tmux :noweb yes
|
||||
set -g @resurrect-processes '<<resurrect-processes()>>'
|
||||
#+end_src
|
||||
|
||||
* Keybindings
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: Keybindings-tx80rdd1huj0
|
||||
|
@ -122,9 +145,14 @@ that”.
|
|||
|------------+------------------+-----------------|
|
||||
| =«= | select-window -p | |
|
||||
| =»= | select-window -n | |
|
||||
| =p= | | pane |
|
||||
| =Tab= | | windows |
|
||||
| =w= | | pane |
|
||||
| =y= | | copy-mode |
|
||||
|
||||
Note I am using the key =w= to access the pane prefix because of how
|
||||
used to Emacs I am, and in Emacs terminology panes are windows while
|
||||
tmux windows would be tabs.
|
||||
|
||||
#+name: gen-keybinds
|
||||
#+begin_src emacs-lisp :var keybinds=std-prefix :var prefix="prefix" :exports none
|
||||
(mapconcat (lambda (keybind)
|
||||
|
@ -145,7 +173,8 @@ that”.
|
|||
#+RESULTS: gen-keybinds
|
||||
: bind-key -T prefix « select-window -p
|
||||
: bind-key -T prefix » select-window -n
|
||||
: bind-key -T prefix p switch-client -T pane
|
||||
: bind-key -T prefix Tab switch-client -T windows
|
||||
: bind-key -T prefix w switch-client -T pane
|
||||
: bind-key -T prefix y switch-client -T copy-mode
|
||||
|
||||
#+begin_src tmux
|
||||
|
@ -168,10 +197,10 @@ open in the same directory as the directory I am currently in.
|
|||
|------------+-------------------------------------------+-----------------|
|
||||
| =/= | split-window -h -c "#{pane-current_path}" | |
|
||||
| =-= | split-window -v -c "#{pane-current_path}" | |
|
||||
| =c= | select-panel -L | |
|
||||
| =t= | select-panel -D | |
|
||||
| =s= | select-panel -U | |
|
||||
| =r= | select-panel -R | |
|
||||
| =c= | select-pane -L | |
|
||||
| =t= | select-pane -D | |
|
||||
| =s= | select-pane -U | |
|
||||
| =r= | select-pane -R | |
|
||||
| =.= | | pane-resize |
|
||||
|
||||
#+begin_src tmux
|
||||
|
@ -199,6 +228,51 @@ any key that is not part of the current prefix will get us out of it.
|
|||
<<gen-keybinds(keybinds=pane-resize-prefix, prefix="pane-resize")>>
|
||||
#+end_src
|
||||
|
||||
** Windows
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: KeybindingsWindows-zg3fjes0luj0
|
||||
:END:
|
||||
Since windows are more akin to tabs in Emacs, and I am way more used
|
||||
to it than Tmux, all keybinds are prefixed with a =Tab=, itself prefixed
|
||||
with the main prefix.
|
||||
#+name: windows-prefix
|
||||
| Keybinding | Command |
|
||||
|------------+-----------------|
|
||||
| c | new-window |
|
||||
| n | next-window |
|
||||
| p | previous-window |
|
||||
|
||||
#+begin_src tmux
|
||||
<<gen-keybinds(keybinds=windows-prefix, prefix="windows")>>
|
||||
#+end_src
|
||||
|
||||
In order to access more easily the different windows, I want to be able to type =<prefix> TAB <window number>=. However, I’m using the bépo layout, numbers are available only when pressing shift. Otherwise, the characters typed are ="«»()@+-/*= (from 1 to 0).
|
||||
#+begin_src emacs-lisp :wrap src tmux :exports code
|
||||
(let ((keybinds "")
|
||||
(keys '("\\\"" "«" "»" "(" ")" "@" "+" "-" "/" "*")))
|
||||
(dotimes (i (length keys) keybinds)
|
||||
(setq keybinds (string-trim
|
||||
(concat keybinds
|
||||
"\n"
|
||||
(format "bind-key -T windows %s select-window -t :=%d"
|
||||
(nth i keys)
|
||||
(1+ i)))))))
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_src tmux
|
||||
bind-key -T windows \" select-window -t :=1
|
||||
bind-key -T windows « select-window -t :=2
|
||||
bind-key -T windows » select-window -t :=3
|
||||
bind-key -T windows ( select-window -t :=4
|
||||
bind-key -T windows ) select-window -t :=5
|
||||
bind-key -T windows @ select-window -t :=6
|
||||
bind-key -T windows + select-window -t :=7
|
||||
bind-key -T windows - select-window -t :=8
|
||||
bind-key -T windows / select-window -t :=9
|
||||
bind-key -T windows * select-window -t :=10
|
||||
#+end_src
|
||||
|
||||
** Copy in vi mode
|
||||
:PROPERTIES:
|
||||
:CUSTOM_ID: KeybindingsCopyinvimode-2mjfpie1huj0
|
||||
|
|
Loading…
Reference in New Issue