Compare commits

..

18 Commits

Author SHA1 Message Date
tdehaeze e84076bb08 Corrected stig configuration 2026-04-16 23:05:26 +02:00
tdehaeze 38bed9f247 Remove timer in polybar 2026-04-16 22:53:32 +02:00
tdehaeze bf6c7e024d Remove ranger as yazi is now used 2026-04-16 22:53:23 +02:00
tdehaeze a2edbc33e7 Add tmux installation script 2026-04-16 22:52:25 +02:00
tdehaeze ace4b0c7f7 Add --noconfirm to paru commands for non-interactive installs 2026-04-15 15:25:50 +02:00
tdehaeze 6afc232505 Move pwvucontrol to optional package (currently broken in AUR) 2026-04-15 15:20:34 +02:00
tdehaeze 24adaf03c3 Just generate one ssh key per machine 2026-04-15 15:17:06 +02:00
tdehaeze b8eb9cbc0e Tangle script 2026-04-15 15:08:14 +02:00
tdehaeze 96f57c1c78 Automatic key generation 2026-04-15 15:07:30 +02:00
tdehaeze f87c433fe8 Might solve some issue with ssh and kitty (tbc) 2026-04-15 14:53:30 +02:00
tdehaeze 2245f91b5b Add Calendar install script 2026-04-15 14:53:19 +02:00
tdehaeze a29050a389 Switch from RSA to ED25519 ssh keys 2026-04-15 14:52:33 +02:00
tdehaeze 38e8ea43cd Improvements when installing the new machine 2026-04-15 13:35:39 +02:00
tdehaeze d11455427c hostnamectl instead of hostname 2026-04-15 13:11:59 +02:00
tdehaeze 05da66e888 Remove some gtk installation 2026-04-15 11:45:34 +02:00
tdehaeze 452ce78c46 Move from pdftk to qpdf
Remove dependency on java
2026-04-15 11:39:19 +02:00
tdehaeze 579d141d93 neofetch => fastfetch 2026-04-15 11:12:45 +02:00
tdehaeze 855902bd61 Update install script 2026-04-15 11:11:02 +02:00
19 changed files with 396 additions and 1062 deletions
+5 -3
View File
@@ -86,7 +86,7 @@ bind '"\e[B": history-search-forward'
** Kitty for SSH ** Kitty for SSH
#+begin_src bash #+begin_src bash
[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh" [ "$TERM" = "xterm-kitty" ] && [ -n "$KITTY_WINDOW_ID" ] && alias ssh="kitty +kitten ssh"
#+end_src #+end_src
** Aliases ** Aliases
@@ -238,13 +238,15 @@ export TEXMFHOME=$HOME/.local/share/texmf
*** Linkding *** Linkding
#+begin_src bash #+begin_src bash
if [ "$(hostnamectl hostname)" = "ldehaeze" ]; then
export LINKDING_URL=`pass nas/linkding_url` export LINKDING_URL=`pass nas/linkding_url`
export LINKDING_TOKEN=`pass nas/linkding_token` export LINKDING_TOKEN=`pass nas/linkding_token`
fi
#+end_src #+end_src
*** Restic *** Restic
#+begin_src bash #+begin_src bash
if [ "$(hostname)" = "ldehaeze" ]; then if [ "$(hostnamectl hostname)" = "ldehaeze" ]; then
export RESTIC_REPOSITORY=sftp:thomas@homelab:/srv/storage/Backups/esrf-laptop export RESTIC_REPOSITORY=sftp:thomas@homelab:/srv/storage/Backups/esrf-laptop
export RESTIC_PASSWORD_COMMAND="pass show restic" export RESTIC_PASSWORD_COMMAND="pass show restic"
fi fi
@@ -258,7 +260,7 @@ export PATH
** Automatically run =startx= ** Automatically run =startx=
#+begin_src bash #+begin_src bash
if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then if [ -z "${DISPLAY}" ] && [ -n "${XDG_VTNR}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
exec startx exec startx
fi fi
#+end_src #+end_src
+14 -14
View File
@@ -378,7 +378,7 @@ List of useful programs:
- =inkscape= - =inkscape=
- =gs= - =gs=
- =pdfcrop= - =pdfcrop=
- =pdftk= - =qpdf=
*** PDF to PNG *** PDF to PNG
#+begin_src bash #+begin_src bash
@@ -439,7 +439,7 @@ pdftrim_function() { \
*** PDF Extract Pages *** PDF Extract Pages
#+begin_src bash #+begin_src bash
pdfextract_function() { \ pdfextract_function() { \
if command -v pdftk &> /dev/null; then if command -v qpdf &> /dev/null; then
pages=$(echo -e "get first\ndelete first\nextract i-j" | rofi -i -dmenu -p "Extract pages") pages=$(echo -e "get first\ndelete first\nextract i-j" | rofi -i -dmenu -p "Extract pages")
if [ -z "$pages" ]; then if [ -z "$pages" ]; then
@@ -448,21 +448,21 @@ pdfextract_function() { \
case "$pages" in case "$pages" in
"get first") "get first")
if command -v pdftk &> /dev/null; then if command -v qpdf &> /dev/null; then
pdftk "$filename_with_extension" cat 1-1 output "$filename_without_extension.first.pdf" qpdf --pages "$filename_with_extension" 1 -- "$filename_with_extension" "$filename_without_extension.first.pdf"
fi fi
;; ;;
"delete first") "delete first")
if command -v pdftk &> /dev/null; then if command -v qpdf &> /dev/null; then
pdftk "$filename_with_extension" cat 2-end output "$filename_with_extension" qpdf --pages "$filename_with_extension" 2-z -- "$filename_with_extension" "$filename_with_extension"
fi fi
;; ;;
"extract i-j") "extract i-j")
# TODO # TODO
page_i=$(rofi -dmenu -p "From") page_i=$(rofi -dmenu -p "From")
page_j=$(rofi -dmenu -p "To") page_j=$(rofi -dmenu -p "To")
if command -v pdftk &> /dev/null; then if command -v qpdf &> /dev/null; then
pdftk "$filename_with_extension" cat "$page_i-$page_j" output "$filename_with_extension.slice.pdf" qpdf --pages "$filename_with_extension" "$page_i-$page_j" -- "$filename_with_extension" "$filename_with_extension.slice.pdf"
fi fi
;; ;;
esac esac
@@ -474,9 +474,9 @@ pdfextract_function() { \
#+begin_src bash #+begin_src bash
pdf_delete_first_page_function() { \ pdf_delete_first_page_function() { \
if command -v stapler &> /dev/null; then if command -v stapler &> /dev/null; then
stapler del "$filename_with_extension" 1 /tmp/pdftk_out.pdf && mv /tmp/pdftk_out.pdf "$filename_with_extension" stapler del "$filename_with_extension" 1 /tmp/qpdf_out.pdf && mv /tmp/qpdf_out.pdf "$filename_with_extension"
elif command -v pdftk &> /dev/null; then elif command -v qpdf &> /dev/null; then
pdftk "$filename_with_extension" cat 2-end output /tmp/pdftk_out.pdf && mv /tmp/pdftk_out.pdf "$filename_with_extension" qpdf --pages "$filename_with_extension" 2-z -- "$filename_with_extension" /tmp/qpdf_out.pdf && mv /tmp/qpdf_out.pdf "$filename_with_extension"
fi fi
} }
#+end_src #+end_src
@@ -484,10 +484,10 @@ pdf_delete_first_page_function() { \
*** Remove Annotations *** Remove Annotations
#+begin_src bash #+begin_src bash
pdf_remove_annotations_function() { \ pdf_remove_annotations_function() { \
if command -v pdftk &> /dev/null; then if command -v qpdf &> /dev/null; then
pdftk "$filename_with_extension" output /tmp/uncompressed.pdf uncompress qpdf --qdf "$filename_with_extension" /tmp/uncompressed.pdf
LANG=C sed -n '/^\/Annots/!p' /tmp/uncompressed.pdf > /tmp/stripped.pdf LANG=C sed -n '/^\/Annots/!p' /tmp/uncompressed.pdf > /tmp/stripped.pdf
pdftk /tmp/stripped.pdf output "$filename_with_extension" compress qpdf /tmp/stripped.pdf "$filename_with_extension"
fi fi
} }
#+end_src #+end_src
+41
View File
@@ -1,6 +1,47 @@
#+TITLE:Calendar and Contact Configuration #+TITLE:Calendar and Contact Configuration
#+SETUPFILE: ./setup/org-setup-file.org #+SETUPFILE: ./setup/org-setup-file.org
* Calendar Install Script
:PROPERTIES:
:header-args:bash: :tangle scripts/install-calendar.sh :shebang "#!/bin/bash" :mkdirp yes
:END:
Calendar/contact documentation: [[file:calendar-contact.org][calendar-contact.org]]
#+begin_src bash
set -euo pipefail
DOTFILES="${HOME}/.config/literate-dotfiles"
tangle() {
emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
}
#+end_src
** Packages
#+begin_src bash
echo "==> Calendar and contacts packages"
paru -S --needed --noconfirm \
vdirsyncer \
khal \
khard
#+end_src
** Tangle Systemd Configs
#+begin_src bash
echo "==> Tangling systemd configs for calendar"
tangle "systemd.org"
#+end_src
** Systemd Timer
#+begin_src bash
echo "==> Enabling vdirsyncer timer"
systemctl --user enable --now vdirsyncer.timer
#+end_src
* =vdirsyncer= - Synchronize calendars and contacts * =vdirsyncer= - Synchronize calendars and contacts
:PROPERTIES: :PROPERTIES:
:header-args: :tangle ~/.config/vdirsyncer/config :header-args: :tangle ~/.config/vdirsyncer/config
+12 -8
View File
@@ -13,31 +13,35 @@ Host backup
hostname pierrick.tdehaeze.xyz hostname pierrick.tdehaeze.xyz
Port 10022 Port 10022
user thomas user thomas
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
Host pierrick Host pierrick
hostname pierrick.tdehaeze.xyz hostname pierrick.tdehaeze.xyz
Port 56432 Port 56432
user pierrick user pierrick
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
Host homelab Host homelab
hostname <<get-password(passname="ip/homelab")>> hostname <<get-password(passname="ip/homelab")>>
Port 22 Port 22
user thomas user thomas
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
Host zotac
hostname 192.168.5.75
Port 22
user thomas
IdentityFile ~/.ssh/id_ed25519
Host router Host router
hostname 192.168.1.1 hostname 192.168.1.1
Port 22 Port 22
user root user root
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
Host *.esrf.fr Host *.esrf.fr
User dehaeze User dehaeze
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
Host firewall.esrf.fr Host firewall.esrf.fr
Port 5022 Port 5022
@@ -49,7 +53,7 @@ Match host *.esrf.fr !host firewall.esrf.fr !exec "~/.ssh/esrf-test"
Host rnice Host rnice
Port 22 Port 22
user dehaeze user dehaeze
IdentityFile ~/.ssh/id_rsa IdentityFile ~/.ssh/id_ed25519
#+end_src #+end_src
#+begin_src bash :tangle ~/.ssh/esrf-test :comments none :mkdirp yes :shebang "#!/usr/bin/env bash" :tangle-mode (identity #o555) #+begin_src bash :tangle ~/.ssh/esrf-test :comments none :mkdirp yes :shebang "#!/usr/bin/env bash" :tangle-mode (identity #o555)
+9 -16
View File
@@ -30,15 +30,7 @@ DOOM="${HOME}/.config/emacs/bin/doom"
#+begin_src bash #+begin_src bash
echo "==> Emacs packages" echo "==> Emacs packages"
paru -S --needed emacs aspell aspell-en aspell-fr paru -S --needed --noconfirm emacs aspell aspell-en aspell-fr
#+end_src
** Doom Emacs
#+begin_src bash
echo "==> Installing Doom Emacs"
git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
"${DOOM}" install --no-config
#+end_src #+end_src
** Tangle Configuration ** Tangle Configuration
@@ -47,15 +39,16 @@ Tangle =doom.org= to generate =config.el=, =init.el= and =packages.el=:
#+begin_src bash #+begin_src bash
echo "==> Tangling doom.org" echo "==> Tangling doom.org"
emacsclient -e "(org-babel-tangle-file \"${DOTFILES}/doom.org\")" \ mkdir ${HOME}/.config/doom
|| emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/doom.org\")" emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/doom.org\")"
#+end_src #+end_src
** Sync ** Doom Install
#+begin_src bash #+begin_src bash
echo "==> Running doom sync" echo "==> Installing Doom Emacs"
"${DOOM}" sync git clone --depth 1 https://github.com/doomemacs/doomemacs ~/.config/emacs
"${DOOM}" install
#+end_src #+end_src
* Introduction and Resources * Introduction and Resources
@@ -360,7 +353,7 @@ Function that opens current pdf page as an SVG file with Inkscape.
(setq filename (read-string "Enter file name:" (car (split-string (file-name-base buffer-file-name) "_")))) (setq filename (read-string "Enter file name:" (car (split-string (file-name-base buffer-file-name) "_"))))
(setq filename (read-string "Enter file name:"))) (setq filename (read-string "Enter file name:")))
(setq filepath (concat "/tmp/" filename ".svg")) (setq filepath (concat "/tmp/" filename ".svg"))
(shell-command (concat "pdftk " buffer-file-name " cat " (number-to-string (pdf-view-current-page)) " output /tmp/pdf_page.pdf")) (shell-command (concat "qpdf --pages " buffer-file-name " " (number-to-string (pdf-view-current-page)) " -- " buffer-file-name " /tmp/pdf_page.pdf"))
(shell-command (concat "pdf2svg /tmp/pdf_page.pdf " filepath)) (shell-command (concat "pdf2svg /tmp/pdf_page.pdf " filepath))
(start-process "" nil "inkscape" filepath)) (start-process "" nil "inkscape" filepath))
@@ -3210,7 +3203,7 @@ Provides nice functions such as:
;;nim ; python + lisp at the speed of c ;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!" ;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel ;;ocaml ; an objective camel
(org +pretty +roam2 +hugo +noter) ; organize your plain life in plain text (org +pretty +roam +hugo +noter) ; organize your plain life in plain text
;;php ; perl's insecure younger brother ;;php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more ;;plantuml ; diagrams for confusing people more
;;graphviz ; diagrams for confusing yourself even more ;;graphviz ; diagrams for confusing yourself even more
+117 -71
View File
@@ -14,7 +14,7 @@ It tangles several install scripts:
- =~/install-latex.sh= — LaTeX toolchain (texlive, biber) - =~/install-latex.sh= — LaTeX toolchain (texlive, biber)
- =~/install-laptop.sh= — laptop-specific tools (tlp, powertop, thermald) - =~/install-laptop.sh= — laptop-specific tools (tlp, powertop, thermald)
All scripts use =paru -S --needed= to be idempotent (safe to re-run). All scripts use =paru -S --needed --noconfirm --noconfirm= to be idempotent (safe to re-run) and non-interactive.
* Prerequisites * Prerequisites
** =git= ** =git=
@@ -50,8 +50,7 @@ set -euo pipefail
DOTFILES="${HOME}/.config/literate-dotfiles" DOTFILES="${HOME}/.config/literate-dotfiles"
tangle() { tangle() {
emacsclient -e "(org-babel-tangle-file \"${DOTFILES}/$1\")" \ emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
|| emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
} }
#+end_src #+end_src
@@ -59,7 +58,7 @@ tangle() {
#+begin_src bash #+begin_src bash
echo "==> Desktop packages" echo "==> Desktop packages"
paru -S --needed \ paru -S --needed --noconfirm \
i3-wm \ i3-wm \
sxhkd \ sxhkd \
polybar \ polybar \
@@ -69,10 +68,8 @@ paru -S --needed \
kitty \ kitty \
bash bash-completion \ bash bash-completion \
zoxide \ zoxide \
nerd-fonts-hack noto-fonts-emoji \
xorg-xrandr arandr \ xorg-xrandr arandr \
xautocfg \ xautocfg \
arc-gtk-theme xcursor-breeze \
feh xwallpaper feh xwallpaper
#+end_src #+end_src
@@ -108,13 +105,19 @@ i3-msg restart 2>/dev/null || echo " (i3 not running, config will apply on next
#+begin_src bash #+begin_src bash
set -euo pipefail set -euo pipefail
DOTFILES="${HOME}/.config/literate-dotfiles"
tangle() {
emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
}
#+end_src #+end_src
** Shell and Terminal ** Shell and Terminal
#+begin_src bash #+begin_src bash
echo "==> Shell and Terminal" echo "==> Shell and Terminal"
paru -S --needed \ paru -S --needed --noconfirm \
bash bash-completion zsh \ bash bash-completion zsh \
kitty \ kitty \
tmux tmux
@@ -126,8 +129,10 @@ paru -S --needed \
#+begin_src bash #+begin_src bash
echo "==> Fonts" echo "==> Fonts"
paru -S --needed \ paru -S --needed --noconfirm \
nerd-fonts-hack \ ttf-hack-nerd \
ttf-sourcecodepro-nerd \
adobe-source-code-pro-fonts \
noto-fonts-emoji noto-fonts-emoji
#+end_src #+end_src
@@ -137,7 +142,7 @@ Default fonts: Monospace/Serif/Sans = =Hack Nerd Font=.
#+begin_src bash #+begin_src bash
echo "==> Text Editors" echo "==> Text Editors"
paru -S --needed \ paru -S --needed --noconfirm \
neovim python-pynvim nodejs-neovim \ neovim python-pynvim nodejs-neovim \
emacs \ emacs \
aspell aspell-en aspell-fr aspell aspell-en aspell-fr
@@ -157,7 +162,7 @@ Emacs config: [[./doom.org][doom.org]]
#+begin_src bash #+begin_src bash
echo "==> GnuPG and Pass" echo "==> GnuPG and Pass"
paru -S --needed \ paru -S --needed --noconfirm \
gnupg gnome-keyring \ gnupg gnome-keyring \
pass rofi-pass pass-git-helper pass rofi-pass pass-git-helper
#+end_src #+end_src
@@ -192,7 +197,7 @@ ssh-add ~/.ssh/id_ed25519
#+begin_src bash #+begin_src bash
echo "==> Window Manager and Desktop" echo "==> Window Manager and Desktop"
paru -S --needed \ paru -S --needed --noconfirm \
i3-wm \ i3-wm \
sxhkd \ sxhkd \
polybar \ polybar \
@@ -213,7 +218,7 @@ paru -S --needed \
#+begin_src bash #+begin_src bash
echo "==> File Manager" echo "==> File Manager"
paru -S --needed yazi paru -S --needed --noconfirm yazi
#+end_src #+end_src
Yazi config: [[file:yazi.org][yazi.org]] Yazi config: [[file:yazi.org][yazi.org]]
@@ -222,20 +227,20 @@ Yazi config: [[file:yazi.org][yazi.org]]
#+begin_src bash #+begin_src bash
echo "==> Terminal Utilities" echo "==> Terminal Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
fd ripgrep fzf \ fd ripgrep fzf \
xclip xsel \ xclip xsel \
atool unzip \ atool unzip \
trash-cli \ trash-cli \
man-db \ man-db \
neofetch fastfetch
#+end_src #+end_src
** Browser ** Browser
#+begin_src bash #+begin_src bash
echo "==> Browser" echo "==> Browser"
paru -S --needed \ paru -S --needed --noconfirm \
qutebrowser python-adblock pdfjs \ qutebrowser python-adblock pdfjs \
firefox-developer-edition passff-host firefox-developer-edition passff-host
#+end_src #+end_src
@@ -252,10 +257,11 @@ Spell checking for qutebrowser:
#+begin_src bash #+begin_src bash
echo "==> Media" echo "==> Media"
paru -S --needed \ paru -S --needed --noconfirm \
mpv \ mpv \
jellyfin-tui \ jellyfin-tui \
nsxiv \ nsxiv \
tesseract tesseract-data-eng tesseract-data-fra tesseract-data-osd \
zathura zathura-pdf-mupdf zathura-djvu zathura-ps zathura-cb \ zathura zathura-pdf-mupdf zathura-djvu zathura-ps zathura-cb \
pdfpc \ pdfpc \
gst-plugins-ugly gst-plugins-good gst-plugins-base-libs gst-plugins-base gst-plugins-bad gst-libav gst-plugins-ugly gst-plugins-good gst-plugins-base-libs gst-plugins-base gst-plugins-bad gst-libav
@@ -263,12 +269,18 @@ paru -S --needed \
** Sound (PipeWire) ** Sound (PipeWire)
Core PipeWire packages (required):
#+begin_src bash #+begin_src bash
echo "==> PipeWire" echo "==> PipeWire"
paru -S --needed \ paru -S --needed --noconfirm \
pipewire pipewire-alsa pipewire-audio pipewire-jack pipewire-pulse \ pipewire pipewire-alsa pipewire-audio pipewire-jack pipewire-pulse \
wireplumber \ wireplumber
pwvucontrol #+end_src
Optional GUI control (install manually when available):
#+begin_src bash :tangle no
echo "==> PipeWire GUI (optional)"
paru -S --needed --noconfirm pwvucontrol || echo "pwvucontrol failed, skipping"
#+end_src #+end_src
Enable PipeWire services: Enable PipeWire services:
@@ -282,8 +294,8 @@ systemctl --user enable --now wireplumber.service
#+begin_src bash #+begin_src bash
echo "==> PDF and Image Utilities" echo "==> PDF and Image Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
pdf2svg pdftk pdfarranger \ pdf2svg qpdf pdfarranger \
imagemagick \ imagemagick \
maim flameshot \ maim flameshot \
unclutter \ unclutter \
@@ -294,7 +306,7 @@ paru -S --needed \
#+begin_src bash #+begin_src bash
echo "==> Office" echo "==> Office"
paru -S --needed \ paru -S --needed --noconfirm \
onlyoffice-bin \ onlyoffice-bin \
libreoffice-fresh libreoffice-fresh-fr \ libreoffice-fresh libreoffice-fresh-fr \
inkscape inkscape
@@ -304,7 +316,7 @@ paru -S --needed \
#+begin_src bash #+begin_src bash
echo "==> System Utilities" echo "==> System Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
udiskie \ udiskie \
blueman \ blueman \
sshfs \ sshfs \
@@ -327,34 +339,97 @@ Enable Syncthing:
systemctl --user enable --now syncthing systemctl --user enable --now syncthing
#+end_src #+end_src
** GTK Theme
#+begin_src bash
echo "==> GTK Theme"
paru -S --needed \
lxappearance \
arc-gtk-theme \
xcursor-breeze \
gtk2fontsel
#+end_src
** Misc Utilities ** Misc Utilities
#+begin_src bash #+begin_src bash
echo "==> Misc Utilities" echo "==> Misc Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
screenkey \
xwallpaper \ xwallpaper \
highlight-pointer-git \ highlight-pointer-git \
mpd mpd
#+end_src #+end_src
** SSH Keys for Tunnels
Use a single SSH key for all hosts (matches =~/.ssh/config=).
#+begin_src bash
KEY_FILE="$HOME/.ssh/id_ed25519"
HOMELAB_OK=1
ESRF_OK=1
# Generate main SSH key if it doesn't exist
if [ ! -f "${KEY_FILE}" ]; then
echo ""
echo "==> Generating main SSH key"
read -p "Generate new SSH key at ${KEY_FILE}? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
ssh-keygen -t ed25519 -C "thomas@$(hostname)" -f "${KEY_FILE}" -N ""
else
echo "Skipping SSH key generation"
fi
fi
# Deploy key to a remote host if needed
deploy_ssh_key() {
local host_name="$1"
local remote_host="$2"
local remote_port="${3:-22}"
echo ""
echo "==> Checking SSH key for ${host_name}"
# Check if we can connect without password
if ssh -o BatchMode=yes -o ConnectTimeout=5 -p "${remote_port}" "${remote_host}" exit 2>/dev/null; then
echo "SSH key for ${host_name} is already deployed ✓"
return 0
fi
# Prompt to deploy key
read -p "Deploy SSH key to ${remote_host}? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
ssh-copy-id -i "${KEY_FILE}.pub" -p "${remote_port}" "${remote_host}"
return 0
else
echo "Skipping ${host_name} key deployment"
return 1
fi
}
# Setup homelab
deploy_ssh_key "homelab" "homelab" 22
HOMELAB_OK=$?
# Setup ESRF
deploy_ssh_key "esrf" "dehaeze@firewall.esrf.fr" 8022
ESRF_OK=$?
#+end_src
** Systemd Services ** Systemd Services
Enable custom systemd services (tangle [[file:systemd.org][systemd.org]] first): #+begin_src bash
#+begin_src bash :tangle no echo "==> Tangling systemd configs"
tangle "systemd.org"
#+end_src
Enable custom =systemd= services:
#+begin_src bash
echo "==> Enabling systemd services"
if [ $HOMELAB_OK -eq 0 ]; then
systemctl --user enable --now homelab-tunnel systemctl --user enable --now homelab-tunnel
else
echo " Skipping homelab-tunnel (SSH key not configured)"
fi
if [ $ESRF_OK -eq 0 ]; then
systemctl --user enable --now esrf-tunnel systemctl --user enable --now esrf-tunnel
else
echo " Skipping esrf-tunnel (SSH key not configured)"
fi
systemctl --user enable --now syncthing systemctl --user enable --now syncthing
#+end_src #+end_src
@@ -387,7 +462,7 @@ set -euo pipefail
#+begin_src bash #+begin_src bash
echo "==> Mail packages" echo "==> Mail packages"
paru -S --needed \ paru -S --needed --noconfirm \
isync \ isync \
msmtp \ msmtp \
neomutt \ neomutt \
@@ -411,35 +486,6 @@ systemctl --user enable --now checkmail.timer
systemctl --user enable --now syncmail.timer systemctl --user enable --now syncmail.timer
#+end_src #+end_src
* Calendar Install Script
:PROPERTIES:
:header-args:bash: :tangle scripts/install-calendar.sh :shebang "#!/bin/bash" :mkdirp yes
:END:
Calendar/contact documentation: [[file:calendar-contact.org][calendar-contact.org]]
#+begin_src bash
set -euo pipefail
#+end_src
** Packages
#+begin_src bash
echo "==> Calendar and contacts packages"
paru -S --needed \
vdirsyncer \
khal \
khard \
mu
#+end_src
** Systemd Timer
#+begin_src bash :tangle no
echo "==> Enabling vdirsyncer timer"
systemctl --user enable --now vdirsyncer.timer
#+end_src
* LaTeX Install Script * LaTeX Install Script
:PROPERTIES: :PROPERTIES:
:header-args:bash: :tangle scripts/install-latex.sh :shebang "#!/bin/bash" :mkdirp yes :header-args:bash: :tangle scripts/install-latex.sh :shebang "#!/bin/bash" :mkdirp yes
@@ -453,7 +499,7 @@ set -euo pipefail
#+begin_src bash #+begin_src bash
echo "==> LaTeX packages" echo "==> LaTeX packages"
paru -S --needed \ paru -S --needed --noconfirm \
texlive-most tllocalmgr-git \ texlive-most tllocalmgr-git \
biber biber
#+end_src #+end_src
@@ -474,7 +520,7 @@ set -euo pipefail
#+begin_src bash #+begin_src bash
echo "==> Laptop power management" echo "==> Laptop power management"
paru -S --needed \ paru -S --needed --noconfirm \
powertop \ powertop \
tlp \ tlp \
thermald thermald
+1 -1
View File
@@ -62,7 +62,7 @@ font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
modules-left = i3 xwindow modules-left = i3 xwindow
modules-center = modules-center =
modules-right = pipewire music tunnel_homelab tunnel_esrf dunst lockscreen cursor unread_mail calendar timer battery date tray modules-right = pipewire music tunnel_homelab tunnel_esrf dunst lockscreen cursor unread_mail calendar battery date tray
# wm-restack = i3 # wm-restack = i3
#+END_SRC #+END_SRC
-856
View File
@@ -1,856 +0,0 @@
#+TITLE: Ranger
#+SETUPFILE: ./setup/org-setup-file.org
* Documentation
#+begin_quote
%f the highlighted file
%d the path of the current directory
%s the selected files in the current directory
%t all tagged files in the current directory
%c the full paths of the currently copied/cut files
%p the full paths of selected files
#+end_quote
After install, run:
#+begin_src bash :tangle no
ranger --copy-config=scope
#+end_src
To add =scope.sh=.
The following has been added to preview =xournalpp= file:
#+begin_src bash
case "${FILE_EXTENSION_LOWER}" in
## xournall file
xopp)
xournalpp-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
;;
esac
#+end_src
To have image preview:
#+begin_src bash :tangle no
sudo pip3 install ueberzug
#+end_src
* Config
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/rc.conf
:header-args+: :comments both :mkdirp yes
:END:
** Options
#+BEGIN_SRC conf
# Which viewmode should be used? Possible values are:
# miller: Use miller columns which show multiple levels of the hierarchy
# multipane: Midnight-commander like multipane view showing all tabs next
# to each other
set viewmode miller
# How many columns are there, and what are their relative widths?
set column_ratios 1,1
# Which files should be hidden? (regular expression)
set hidden_filter ^\.|\.(?:pyc|vrb|pyo|lof|bak|swp|aux|log|nav|out|snm|toc|bcf|run\.xml|synctex\.gz|blg|bbl|xopp~)$|^lost\+found$|^__(py)?cache__$
# Show hidden files? You can toggle this by typing 'zh'
set show_hidden false
# Ask for a confirmation when running the "delete" command?
# Valid values are "always", "never", "multiple" (default)
# With "multiple", ranger will ask only if you delete multiple files at once.
set confirm_on_delete multiple
# Which script is used to generate file previews?
# ranger ships with scope.sh, a script that calls external programs (see
# README.md for dependencies) to preview images, archives, etc.
set preview_script /home/thomas/.config/ranger/scope.sh
# Use the external preview script or display simple plain text or image previews?
set use_preview_script true
# Automatically count files in the directory, even before entering them?
set automatically_count_files true
# Open all images in this directory when running certain image viewers
set open_all_images true
# Be aware of version control systems and display information.
set vcs_aware false
# Use one of the supported image preview protocols
set preview_images true
# Set the preview image method
set preview_images_method ueberzug
set colorscheme default
# Preview files on the rightmost column?
# And collapse (shrink) the last column if there is nothing to preview?
set preview_files true
set preview_directories true
set collapse_preview true
# Draw the status bar on top of the browser window (default: bottom)
set status_bar_on_top false
# Draw a progress bar in the status bar which displays the average state of all
# currently running tasks which support progress bars?
set draw_progress_bar_in_status_bar true
# Draw borders around columns?
set draw_borders true
# Display the directory name in tabs?
set dirname_in_tabs false
# Enable the mouse support?
set mouse_enabled true
# Display the file size in the main column or status bar?
set display_size_in_main_column true
set display_size_in_status_bar false
# Display files tags in all columns or only in main column?
set display_tags_in_all_columns false
# Set a title for the window?
set update_title false
# Set the title to "ranger" in the tmux program?
set update_tmux_title true
# Shorten the title if it gets long? The number defines how many
# directories are displayed at once, 0 turns off this feature.
set shorten_title 3
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
set tilde_in_titlebar true
# How many directory-changes or console-commands should be kept in history?
set max_history_size 20
set max_console_history_size 50
# Try to keep so much space between the top/bottom border when scrolling:
set scroll_offset 8
# Flush the input after each key hit? (Noticeable when ranger lags)
set flushinput true
# Padding on the right when there's no preview?
# This allows you to click into the space to run the file.
set padding_right true
set autosave_bookmarks false
set autoupdate_cumulative_size false
# Turning this on makes sense for screen readers:
set show_cursor false
# One of: size, natural, basename, atime, ctime, mtime, type, random
set sort natural
# Additional sorting options
set sort_reverse false
set sort_case_insensitive true
set sort_directories_first true
set sort_unicode false
# Enable this if key combinations with the Alt Key don't work for you.
# (Especially on xterm)
set xterm_alt_key false
# Whether to include bookmarks in cd command
set cd_bookmarks false
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
# disable this feature.
set preview_max_size 5000000
# Add the highlighted file to the path in the titlebar
set show_selection_in_titlebar true
# The delay that ranger idly waits for user input, in milliseconds, with a
# resolution of 100ms. Lower delay reduces lag between directory updates but
# increases CPU load.
set idle_delay 2000
# When the metadata manager module looks for metadata, should it only look for
# a ".metadata.json" file in the current directory, or do a deep search and
# check all directories above the current one as well?
set metadata_deep_search false
# Clear all existing filters when leaving a directory
set clear_filters_on_dir_change false
# Disable displaying line numbers in main column
set line_numbers false
#+END_SRC
** Command Aliases in the Console
#+BEGIN_SRC conf
alias q quit
alias filter scout -prt
alias find scout -aeit
alias mark scout -mr
alias unmark scout -Mr
alias search scout -rs
alias search_inc scout -rts
alias travel scout -aefiklst
#+END_SRC
** Some Custom Keybindings
Extract:
#+BEGIN_SRC conf
map ,x shell ~/.config/ranger/scripts/extract.sh %f
#+END_SRC
Compress:
#+BEGIN_SRC conf
map ,z shell ~/.config/ranger/scripts/compress.sh %f
#+END_SRC
Convert images/pdf/...:
#+BEGIN_SRC conf
map ,c shell convert-file %f
#+END_SRC
Extract BibTeX:
#+begin_src conf
map ,b shell ~/.config/ranger/scripts/add-reference.sh %d/%f
#+end_src
Open SXIV on current directory:
#+BEGIN_SRC conf
map ,s shell nohup sxiv -t %d &
#+END_SRC
Upload to https://0x0.st/:
#+BEGIN_SRC conf
map ,t shell upload %f
#+END_SRC
Open current folder with PCManFM:
#+begin_src conf
map ,o shell nohup pcmanfm %d &
#+end_src
Print on Rnice:
#+BEGIN_SRC conf
map ,p shell print-esrf %f &
#+END_SRC
Backup to NAS:
#+BEGIN_SRC conf
map ,B shell ~/.config/ranger/scripts/backup-to-nas.sh %s &
#+END_SRC
#+begin_src conf
map ,y shell ~/.config/ranger/scripts/copy-content.sh %s &
#+end_src
** Scripts
*** Extract DOI, create BibTeX and rename file
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/add-reference.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
add_reference () {
doi=$(pdf2doi $1 | sed 's/^DOI *//' | sed 's/ \+.*//')
# If empty DOI, ask manually
if [ -z $doi ]; then
doi=$(rofi -dmenu -p "DOI")
fi
# If DOI, add it to Emacs
if [ ! -z $doi ]; then
emacsclient --eval "(tdh-org-ref-import-pdf \"$doi\" \"$1\")" && \
dunstify --replace=49496 "BibTeX" "File copied."
else
dunstify --replace=49496 "BibTeX" "Failed to get DOI"
fi
}
add_reference "$1"
#+end_src
*** Extract Script
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/extract.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 2 atool -x "$1" && tmux select-pane -U
else
atool -x "$1"
fi
#+end_src
*** Compress Script
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/compress.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 2 apack "${1%.*}.zip" "$1" && tmux select-pane -U
else
apack "${1%.*}.zip" "$1"
fi
#+end_src
*** Copy File Content
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/copy-content.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
#+begin_src bash
xclip -sel c < "$1" && notify-send "Ranger" "Copied to clipboard"
#+end_src
*** Paste with Rsync
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/scripts/paste-rsync.sh
:header-args+: :comments both :mkdirp yes
:header-args+: :shebang "#!/usr/bin/env bash"
:END:
- First argument is the directory where to copy files
- All other arguments are files that are to be copied
#+begin_src bash
if [ $TMUX ]; then
tmux split -v -l 1 rsync -a --info=progress2 --no-inc-recursive "${@:2}" "$1" && tmux select-pane -U
else
rsync -a --info=progress2 --no-inc-recursive "${@:2}" "$1"
fi
#+end_src
** Define keys for the browser
*** Basic
#+BEGIN_SRC conf
map Q quit!
map q eval fm.execute_console("shell tmux detach") if 'TMUX' in os.environ.keys() else fm.execute_console("quit")
#+END_SRC
#+BEGIN_SRC conf
map <C-c> abort
map <esc> change_mode normal
map ~ set viewmode!
#+END_SRC
#+BEGIN_SRC conf
map ? help
#+END_SRC
#+BEGIN_SRC conf
map : console
map ; console
#+END_SRC
#+BEGIN_SRC conf
map ! console shell%space
#+END_SRC
#+BEGIN_SRC conf
map @ console -p6 shell %%s
#+END_SRC
*** Open Shell in current directory
#+BEGIN_SRC conf
map s shell $SHELL
map S shell nohup $TERMINAL &
#+END_SRC
*** Open With
#+BEGIN_SRC conf
map O chain draw_possible_programs; console open_with%space
#+END_SRC
*** Filter
#+BEGIN_SRC conf
map f console filter%space
# Reset filter
map F filter
#+END_SRC
*** Tagging / Marking
#+BEGIN_SRC conf
map <Space> mark_files toggle=True
map v mark_files all=True toggle=True
#+END_SRC
*** VIM-like
#+BEGIN_SRC conf
copymap <UP> k
copymap <DOWN> j
copymap <LEFT> h
copymap <RIGHT> l
copymap <HOME> gg
copymap <END> G
#+END_SRC
*** Jumping around
#+BEGIN_SRC conf
map H history_go -1
map L history_go 1
#+END_SRC
#+BEGIN_SRC conf
map ] move_parent 1
map [ move_parent -1
#+END_SRC
#+BEGIN_SRC conf
map } traverse
#+END_SRC
#+BEGIN_SRC conf
map cd console cd%space
#+END_SRC
*** Go to special folders
#+BEGIN_SRC conf
map gh cd ~/
map gw cd ~/Cloud/work-projects
map gp cd ~/Cloud/personnal
map gP cd ~/Cloud/pictures/phone
map gs cd ~/Cloud/pictures/screenshots
map gT cd ~/.local/share/Trash/files
map gd cd ~/Downloads
map gD cd ~/Cloud/documents
map gc cd ~/Cloud
map gV cd ~/.config/literate-dotfiles
map gm cd ~/Cloud/meetings
#+END_SRC
*** Get size of folders
#+BEGIN_SRC conf
# Get size of all folders
map du shell -p du --max-depth=1 -h --apparent-size
# Get size of all folders and sort them
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
#+END_SRC
*** Yank path of directory/file
#+BEGIN_SRC conf
# Yank path of current directory/file
map yp shell -f echo -n %d/%f | xsel -i; xsel -o | xsel -i -b
# Yank path of directory
map yd shell -f echo -n %d | xsel -i; xsel -o | xsel -i -b
# Yank filename
map yn shell -f echo -n %f | xsel -i; xsel -o | xsel -i -b
#+END_SRC
*** Drag and Drop
#+BEGIN_SRC conf
map D shell dragon-drop -a -x %p
#+END_SRC
*** Rename files
#+BEGIN_SRC conf
map a rename_append
map C eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm.open_console("rename ")
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
#+END_SRC
*** Paste files
#+BEGIN_SRC conf
map pp paste
map po paste overwrite=True
map pP paste append=True
map pO paste overwrite=True append=True
map pl paste_symlink relative=False
map pL paste_symlink relative=True
map phl paste_hardlink
map pht paste_hardlinked_subtree
#+END_SRC
Paste with Rsync
#+BEGIN_SRC conf
map pr shell ~/.config/ranger/scripts/paste-rsync.sh %d %c
#+END_SRC
*** Delete and move files
#+BEGIN_SRC conf
map dD shell -s trash-put %s
map dd cut
map du uncut
#+END_SRC
*** Copy files
#+BEGIN_SRC conf
map yy copy
map yu uncut
#+END_SRC
*** Searching
#+BEGIN_SRC conf
map / console search%space
map n search_next
map N search_next forward=False
#+END_SRC
*** Tabs
#+BEGIN_SRC conf
map <C-n> tab_new ~
map <C-w> tab_close
map <TAB> tab_move 1
map <S-TAB> tab_move -1
map gn tab_new ~
map gt tab_move 1
#+END_SRC
*** Settings
#+BEGIN_SRC conf
map zh set show_hidden!
map zi set preview_images!
map zv set use_preview_script!
#+END_SRC
*** Bookmarks
#+BEGIN_SRC conf
map `<any> enter_bookmark %any
map '<any> enter_bookmark %any
map m<any> set_bookmark %any
map um<any> unset_bookmark %any
map m<bg> draw_bookmarks
copymap m<bg> um<bg> `<bg> '<bg>
#+END_SRC
*** FZF
#+BEGIN_SRC conf
map <C-f> fzf_select
#+END_SRC
** Define keys for the console
*** Basic
#+BEGIN_SRC conf
cmap <tab> eval fm.ui.console.tab()
cmap <s-tab> eval fm.ui.console.tab(-1)
cmap <ESC> eval fm.ui.console.close()
cmap <CR> eval fm.ui.console.execute()
cmap <C-l> redraw_window
copycmap <ESC> <C-c>
copycmap <CR> <C-j>
#+END_SRC
*** Move around
#+BEGIN_SRC conf
cmap <up> eval fm.ui.console.history_move(-1)
cmap <down> eval fm.ui.console.history_move(1)
cmap <left> eval fm.ui.console.move(left=1)
cmap <right> eval fm.ui.console.move(right=1)
#+END_SRC
*** Line Editing
#+BEGIN_SRC conf
cmap <backspace> eval fm.ui.console.delete(-1)
cmap <delete> eval fm.ui.console.delete(0)
cmap <C-w> eval fm.ui.console.delete_word()
cmap <C-y> eval fm.ui.console.paste()
copycmap <home> <C-a>
copycmap <end> <C-e>
#+END_SRC
* Rifle
:PROPERTIES:
:CUSTOM_ID: rifle
:header-args: :tangle ~/.config/ranger/rifle.conf
:header-args+: :comments both :mkdirp yes
:END:
** Documentation
#+BEGIN_SRC conf :tangle no
# This is the configuration file of "rifle", ranger's file executor/opener.
# Each line consists of conditions and a command. For each line the conditions
# are checked and if they are met, the respective command is run.
#
# Syntax:
# <condition1> , <condition2> , ... = command
#
# The command can contain these environment variables:
# $1-$9 | The n-th selected file
# $@ | All selected files
#
# If you use the special command "ask", rifle will ask you what program to run.
#
# Prefixing a condition with "!" will negate its result.
# These conditions are currently supported:
# match <regexp> | The regexp matches $1
# ext <regexp> | The regexp matches the extension of $1
# mime <regexp> | The regexp matches the mime type of $1
# name <regexp> | The regexp matches the basename of $1
# path <regexp> | The regexp matches the absolute path of $1
# has <program> | The program is installed (i.e. located in $PATH)
# env <variable> | The environment variable "variable" is non-empty
# file | $1 is a file
# directory | $1 is a directory
# number <n> | change the number of this command to n
# terminal | stdin, stderr and stdout are connected to a terminal
# X | $DISPLAY is not empty (i.e. Xorg runs)
#
# There are also pseudo-conditions which have a "side effect":
# flag <flags> | Change how the program is run. See below.
# label <label> | Assign a label or name to the command so it can
# | be started with :open_with <label> in ranger
# | or `rifle -p <label>` in the standalone executable.
# else | Always true.
#
# Flags are single characters which slightly transform the command:
# f | Fork the program, make it run in the background.
# | New command = setsid $command >& /dev/null &
# r | Execute the command with root permissions
# | New command = sudo $command
# t | Run the program in a new terminal. If $TERMCMD is not defined,
# | rifle will attempt to extract it from $TERM.
# | New command = $TERMCMD -e $command
# Note: The "New command" serves only as an illustration, the exact
# implementation may differ.
# Note: When using rifle in ranger, there is an additional flag "c" for
# only running the current file even if you have marked multiple files.
#+END_SRC
** Websites
#+BEGIN_SRC conf
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
ext x?html?, has firefox, X, flag f = firefox -- "$@"
ext x?html?, has elinks, terminal = elinks "$@"
ext x?html?, has w3m, terminal = w3m "$@"
#+END_SRC
** Text Files
3D files (before the rest)
#+begin_src conf
ext stp, X, flag f = f3d -- "$@"
ext step, X, flag f = f3d -- "$@"
ext stl, X, flag f = f3d -- "$@"
#+end_src
Calendar files
#+begin_src conf
ext ics, X, flag f = ics-add "$@"
#+end_src
Define the =$EDITOR= for text files as first action:
#+BEGIN_SRC conf
mime ^text, label editor = $EDITOR -- "$@"
mime ^text, label pager = "$PAGER" -- "$@"
#+END_SRC
Favorite editors:
#+begin_src conf
mime ^text, has nvim, flag f = nvim "$@"
mime ^text, has emacsclient, X, flag f = emacsclient -c "$@"
#+end_src
Org mode files
#+BEGIN_SRC conf
ext org, has emacsclient, X, flag f = emacsclient -c "$@"
#+END_SRC
#+BEGIN_SRC conf
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext sh = sh -- "$1"
ext php = php -- "$1"
#+END_SRC
** PDF, Epub and jdvu
#+BEGIN_SRC conf
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has mupdf, X, flag f = mupdf "$@"
ext pdf, X, flag f = "$BROWSER" "$@"
#+END_SRC
#+BEGIN_SRC conf
ext epub, has zathura, X, flag f = zathura -- "$@"
ext epub, has mupdf, X, flag f = mupdf "$@"
#+END_SRC
#+BEGIN_SRC conf
ext djvu, has zathura, X, flag f = zathura -- "$@"
ext djvu, has evince, X, flag f = evince -- "$@"
ext djvu, has atril, X, flag f = atril -- "$@"
#+END_SRC
** Xournalpp
#+begin_src conf
ext xopp, X, flag f = xournalpp "$@"
#+end_src
** Archives
#+BEGIN_SRC conf
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool -- "$@" | "$PAGER"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool -- "$@" | "$PAGER"
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has aunpack = aunpack -- "$@"
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has aunpack = aunpack -- "$@"
ext tar|gz, has tar = tar vvtf "$@" | "$PAGER"
ext tar|gz, has tar = tar vvxf "$@"
#+END_SRC
** Torrent
#+BEGIN_SRC conf
ext torrent, X, flag f = stig add -- "$@"
#+END_SRC
** Word, Excel and Presentation files
#+BEGIN_SRC conf
ext docx?, has onlyoffice-desktopeditors, X, flag f = onlyoffice-desktopeditors "$@"
ext docx?, has wps, X, flag f = wps "$@"
ext docx?, has libreoffice, X, flag f = libreoffice "$@"
#+END_SRC
#+begin_src conf
ext pptx?, has onlyoffice-desktopeditors, X, flag f = onlyoffice-desktopeditors "$@"
ext pptx?, has wps, X, flag f = wps "$@"
ext pptx?, has libreoffice, X, flag f = libreoffice "$@"
#+end_src
#+begin_src conf
ext csv|xlsx?, has sc-im = sc-im -- "$@"
ext csv|xlsx?, has onlyoffice-desktopeditors, X, flag f = onlyoffice-desktopeditors "$@"
ext csv|xlsx?, has wps, X, flag f = wps "$@"
ext csv|xlsx?, has libreoffice, X, flag f = libreoffice "$@"
#+end_src
** Images
#+BEGIN_SRC conf
mime ^image/svg, has inkview, X, flag f = inkview -- "$@"
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
mime ^image/svg, has display, X, flag f = display -- "$@"
#+END_SRC
#+BEGIN_SRC conf
mime ^image/gif, has mpv, X, flag f = mpv --loop -- "$@"
mime ^image/gif, has qutebrowser, X, flag f = qutebrowser -- "$@"
#+END_SRC
#+BEGIN_SRC conf
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
mime ^image, has feh, X, flag f = feh --scale-down --auto-zoom -- "$@"
#+END_SRC
** Audio
#+BEGIN_SRC conf
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@"
mime ^audio|ogg$, X, flag f, has vlc = vlc -- "$@"
#+END_SRC
** Video
#+BEGIN_SRC conf
mime ^video, has mpv, X, flag f = mpv -- "$@"
mime ^video, has vlc, X, flag f = vlc -- "$@"
#+END_SRC
** Misc
#+BEGIN_SRC conf
ext 1 = man "$1"
ext s[wmf]c, has zsnes, X = zsnes "$1"
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
ext nes, has fceux, X = fceux "$1"
ext exe = wine "$1"
name ^[mM]akefile$ = make
mime application/vnd.ms-tnef = winmail-add "$@"
#+END_SRC
#+BEGIN_SRC conf
# Define the editor for non-text files + pager as last action
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = $EDITOR -- "$@"
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
has dragon-drop, X, flag f = dragon-drop -a -x "$@"
#+END_SRC
* Ranger Commands
:PROPERTIES:
:header-args: :tangle ~/.config/ranger/commands.py
:header-args+: :comments both :mkdirp yes
:END:
** Import
#+begin_src python
from ranger.api.commands import *
import os
#+end_src
** fzf_select
#+begin_src python
class fzf_select(Command):
"""
:fzf_select
Find a file using fzf.
With a prefix argument select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
if self.quantifier:
# match only directories
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
-o -type d -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
else:
# match files and directories
command="find -L . \( -path '*/\.*' -o -fstype 'dev' -o -fstype 'proc' \) -prune \
-o -print 2> /dev/null | sed 1d | cut -b3- | fzf +m"
fzf = self.fm.execute_command(command, stdout=subprocess.PIPE)
stdout, stderr = fzf.communicate()
if fzf.returncode == 0:
fzf_file = os.path.abspath(stdout.decode('utf-8').rstrip('\n'))
if os.path.isdir(fzf_file):
self.fm.cd(fzf_file)
else:
self.fm.select_file(fzf_file)
# fzf_locate
class fzf_locate(Command):
"""
:fzf_locate
Find a file using fzf.
With a prefix argument select only directories.
See: https://github.com/junegunn/fzf
"""
def execute(self):
import subprocess
if self.quantifier:
command="locate home media | fzf -e -i"
else:
command="locate home media | fzf -e -i"
fzf = self.fm.execute_command(command, stdout=subprocess.PIPE)
stdout, stderr = fzf.communicate()
if fzf.returncode == 0:
fzf_file = os.path.abspath(stdout.decode('utf-8').rstrip('\n'))
if os.path.isdir(fzf_file):
self.fm.cd(fzf_file)
else:
self.fm.select_file(fzf_file)
#+end_src
+14 -3
View File
@@ -1,9 +1,20 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
DOTFILES="${HOME}/.config/literate-dotfiles"
tangle() {
emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
}
echo "==> Calendar and contacts packages" echo "==> Calendar and contacts packages"
paru -S --needed \ paru -S --needed --noconfirm \
vdirsyncer \ vdirsyncer \
khal \ khal \
khard \ khard
mu
echo "==> Tangling systemd configs for calendar"
tangle "systemd.org"
echo "==> Enabling vdirsyncer timer"
systemctl --user enable --now vdirsyncer.timer
+2 -5
View File
@@ -4,12 +4,11 @@ set -euo pipefail
DOTFILES="${HOME}/.config/literate-dotfiles" DOTFILES="${HOME}/.config/literate-dotfiles"
tangle() { tangle() {
emacsclient -e "(org-babel-tangle-file \"${DOTFILES}/$1\")" \ emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
|| emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
} }
echo "==> Desktop packages" echo "==> Desktop packages"
paru -S --needed \ paru -S --needed --noconfirm \
i3-wm \ i3-wm \
sxhkd \ sxhkd \
polybar \ polybar \
@@ -19,10 +18,8 @@ paru -S --needed \
kitty \ kitty \
bash bash-completion \ bash bash-completion \
zoxide \ zoxide \
nerd-fonts-hack noto-fonts-emoji \
xorg-xrandr arandr \ xorg-xrandr arandr \
xautocfg \ xautocfg \
arc-gtk-theme xcursor-breeze \
feh xwallpaper feh xwallpaper
echo "==> Tangling desktop configs" echo "==> Tangling desktop configs"
+1 -1
View File
@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
echo "==> Laptop power management" echo "==> Laptop power management"
paru -S --needed \ paru -S --needed --noconfirm \
powertop \ powertop \
tlp \ tlp \
thermald thermald
+1 -1
View File
@@ -2,6 +2,6 @@
set -euo pipefail set -euo pipefail
echo "==> LaTeX packages" echo "==> LaTeX packages"
paru -S --needed \ paru -S --needed --noconfirm \
texlive-most tllocalmgr-git \ texlive-most tllocalmgr-git \
biber biber
+1 -1
View File
@@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
echo "==> Mail packages" echo "==> Mail packages"
paru -S --needed \ paru -S --needed --noconfirm \
isync \ isync \
msmtp \ msmtp \
neomutt \ neomutt \
+99 -28
View File
@@ -1,30 +1,38 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
DOTFILES="${HOME}/.config/literate-dotfiles"
tangle() {
emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/$1\")"
}
echo "==> Shell and Terminal" echo "==> Shell and Terminal"
paru -S --needed \ paru -S --needed --noconfirm \
bash bash-completion zsh \ bash bash-completion zsh \
kitty \ kitty \
tmux tmux
echo "==> Fonts" echo "==> Fonts"
paru -S --needed \ paru -S --needed --noconfirm \
nerd-fonts-hack \ ttf-hack-nerd \
ttf-sourcecodepro-nerd \
adobe-source-code-pro-fonts \
noto-fonts-emoji noto-fonts-emoji
echo "==> Text Editors" echo "==> Text Editors"
paru -S --needed \ paru -S --needed --noconfirm \
neovim python-pynvim \ neovim python-pynvim nodejs-neovim \
emacs \ emacs \
aspell aspell-en aspell-fr aspell aspell-en aspell-fr
echo "==> GnuPG and Pass" echo "==> GnuPG and Pass"
paru -S --needed \ paru -S --needed --noconfirm \
gnupg gnome-keyring \ gnupg gnome-keyring \
pass rofi-pass pass-git-helper pass rofi-pass pass-git-helper
echo "==> Window Manager and Desktop" echo "==> Window Manager and Desktop"
paru -S --needed \ paru -S --needed --noconfirm \
i3-wm \ i3-wm \
sxhkd \ sxhkd \
polybar \ polybar \
@@ -35,53 +43,53 @@ paru -S --needed \
xorg-xrandr arandr xorg-xrandr arandr
echo "==> File Manager" echo "==> File Manager"
paru -S --needed yazi paru -S --needed --noconfirm yazi
echo "==> Terminal Utilities" echo "==> Terminal Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
fd ripgrep fzf \ fd ripgrep fzf \
xclip xsel \ xclip xsel \
atool unzip \ atool unzip \
trash-cli \ trash-cli \
man-db \ man-db \
neofetch fastfetch
echo "==> Browser" echo "==> Browser"
paru -S --needed \ paru -S --needed --noconfirm \
qutebrowser python-adblock pdfjs \ qutebrowser python-adblock pdfjs \
firefox-developer-edition passff-host firefox-developer-edition passff-host
echo "==> Media" echo "==> Media"
paru -S --needed \ paru -S --needed --noconfirm \
mpv \ mpv \
jellyfin-tui \ jellyfin-tui \
nsxiv \ nsxiv \
tesseract tesseract-data-eng tesseract-data-fra tesseract-data-osd \
zathura zathura-pdf-mupdf zathura-djvu zathura-ps zathura-cb \ zathura zathura-pdf-mupdf zathura-djvu zathura-ps zathura-cb \
pdfpc \ pdfpc \
gst-plugins-ugly gst-plugins-good gst-plugins-base-libs gst-plugins-base gst-plugins-bad gst-libav gst-plugins-ugly gst-plugins-good gst-plugins-base-libs gst-plugins-base gst-plugins-bad gst-libav
echo "==> PipeWire" echo "==> PipeWire"
paru -S --needed \ paru -S --needed --noconfirm \
pipewire pipewire-alsa pipewire-audio pipewire-jack pipewire-pulse \ pipewire pipewire-alsa pipewire-audio pipewire-jack pipewire-pulse \
wireplumber \ wireplumber
pwvucontrol
echo "==> PDF and Image Utilities" echo "==> PDF and Image Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
pdf2svg pdftk pdfarranger \ pdf2svg qpdf pdfarranger \
imagemagick \ imagemagick \
maim flameshot \ maim flameshot \
unclutter \ unclutter \
poppler poppler
echo "==> Office" echo "==> Office"
paru -S --needed \ paru -S --needed --noconfirm \
onlyoffice-bin \ onlyoffice-bin \
libreoffice-fresh libreoffice-fresh-fr \ libreoffice-fresh libreoffice-fresh-fr \
inkscape inkscape
echo "==> System Utilities" echo "==> System Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
udiskie \ udiskie \
blueman \ blueman \
sshfs \ sshfs \
@@ -98,16 +106,79 @@ paru -S --needed \
yt-dlp \ yt-dlp \
python ipython python-pip python ipython python-pip
echo "==> GTK Theme"
paru -S --needed \
lxappearance \
arc-gtk-theme \
xcursor-breeze \
gtk2fontsel
echo "==> Misc Utilities" echo "==> Misc Utilities"
paru -S --needed \ paru -S --needed --noconfirm \
screenkey \
xwallpaper \ xwallpaper \
highlight-pointer-git \ highlight-pointer-git \
mpd mpd
KEY_FILE="$HOME/.ssh/id_ed25519"
HOMELAB_OK=1
ESRF_OK=1
# Generate main SSH key if it doesn't exist
if [ ! -f "${KEY_FILE}" ]; then
echo ""
echo "==> Generating main SSH key"
read -p "Generate new SSH key at ${KEY_FILE}? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
ssh-keygen -t ed25519 -C "thomas@$(hostname)" -f "${KEY_FILE}" -N ""
else
echo "Skipping SSH key generation"
fi
fi
# Deploy key to a remote host if needed
deploy_ssh_key() {
local host_name="$1"
local remote_host="$2"
local remote_port="${3:-22}"
echo ""
echo "==> Checking SSH key for ${host_name}"
# Check if we can connect without password
if ssh -o BatchMode=yes -o ConnectTimeout=5 -p "${remote_port}" "${remote_host}" exit 2>/dev/null; then
echo "SSH key for ${host_name} is already deployed ✓"
return 0
fi
# Prompt to deploy key
read -p "Deploy SSH key to ${remote_host}? [y/N] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
ssh-copy-id -i "${KEY_FILE}.pub" -p "${remote_port}" "${remote_host}"
return 0
else
echo "Skipping ${host_name} key deployment"
return 1
fi
}
# Setup homelab
deploy_ssh_key "homelab" "homelab" 22
HOMELAB_OK=$?
# Setup ESRF
deploy_ssh_key "esrf" "dehaeze@firewall.esrf.fr" 8022
ESRF_OK=$?
echo "==> Tangling systemd configs"
tangle "systemd.org"
echo "==> Enabling systemd services"
if [ $HOMELAB_OK -eq 0 ]; then
systemctl --user enable --now homelab-tunnel
else
echo " Skipping homelab-tunnel (SSH key not configured)"
fi
if [ $ESRF_OK -eq 0 ]; then
systemctl --user enable --now esrf-tunnel
else
echo " Skipping esrf-tunnel (SSH key not configured)"
fi
systemctl --user enable --now syncthing
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# Tmux Install Script
# :PROPERTIES:
# :header-args:bash: :tangle scripts/install-tmux.sh :shebang "#!/bin/bash" :mkdirp yes
# :END:
# [[file:../tmux.org::*Tmux Install Script][Tmux Install Script:1]]
set -euo pipefail
# Tmux Install Script:1 ends here
# Packages
# [[file:../tmux.org::*Packages][Packages:1]]
echo "==> Tmux packages"
paru -S --needed --noconfirm tmux
# Packages:1 ends here
# Tangle Configuration
# [[file:../tmux.org::*Tangle Configuration][Tangle Configuration:1]]
echo "==> Tangling tmux.org"
emacsclient -e '(org-babel-tangle-file "/home/thomas/.config/literate-dotfiles/tmux.org")'
# Tangle Configuration:1 ends here
# Install TPM Plugins
# [[file:../tmux.org::*Install TPM Plugins][Install TPM Plugins:1]]
echo "==> Installing TPM plugins"
if [ ! -d ~/.config/tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm
fi
tmux source ~/.config/tmux/tmux.conf
# Install TPM Plugins:1 ends here
+34 -43
View File
@@ -3,6 +3,39 @@
#+PROPERTY: header-args :tangle ~/.config/tmux/tmux.conf #+PROPERTY: header-args :tangle ~/.config/tmux/tmux.conf
#+PROPERTY: header-args+ :comments both :mkdirp yes #+PROPERTY: header-args+ :comments both :mkdirp yes
* Tmux Install Script
:PROPERTIES:
:header-args:bash: :tangle scripts/install-tmux.sh :shebang "#!/bin/bash" :mkdirp yes
:END:
#+begin_src bash
set -euo pipefail
#+end_src
** Packages
#+begin_src bash
echo "==> Tmux packages"
paru -S --needed --noconfirm tmux
#+end_src
** Tangle Configuration
#+begin_src bash
echo "==> Tangling tmux.org"
emacsclient -e '(org-babel-tangle-file "/home/thomas/.config/literate-dotfiles/tmux.org")'
#+end_src
** Install TPM Plugins
#+begin_src bash
echo "==> Installing TPM plugins"
if [ ! -d ~/.config/tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm ~/.config/tmux/plugins/tpm
fi
tmux source ~/.config/tmux/tmux.conf
#+end_src
* Line * Line
#+begin_src conf #+begin_src conf
# Activate the status bar # Activate the status bar
@@ -206,52 +239,10 @@ set-window-option -g aggressive-resize
** Install plugins ** Install plugins
#+BEGIN_SRC conf #+BEGIN_SRC conf
set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'tmux-plugins/tmux-sessionist'
# set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'nhdaly/tmux-better-mouse-mode' set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'seebi/tmux-colors-solarized' set -g @plugin 'seebi/tmux-colors-solarized'
#+END_SRC #+END_SRC
** Configuration
#+BEGIN_SRC conf
# =============================================================
# tmux-resurrect
# =============================================================
# for vim
set -g @resurrect-strategy-vim 'session'
# for neovim
set -g @resurrect-strategy-nvim 'session'
# Restoring pane contents
set -g @resurrect-capture-pane-contents 'on'
run-shell ~/.tmux/plugins/tmux-resurrect/resurrect.tmux
# =============================================================
# =============================================================
# tmux-continuum
# =============================================================
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
set -g @continuum-save-interval '15'
run-shell ~/.tmux/plugins/tmux-continuum/continuum.tmux
# =============================================================
# =============================================================
# tmux-battery
# =============================================================
set -g @batt_charged_icon "="
set -g @batt_charging_icon "+"
set -g @batt_discharging_icon "-"
set -g @batt_attached_icon "o"
# =============================================================
#+END_SRC
* Colors * Colors
#+BEGIN_SRC conf #+BEGIN_SRC conf
set -g @colors-solarized 'light' set -g @colors-solarized 'light'
@@ -259,5 +250,5 @@ set -g @colors-solarized 'light'
* Initialize TMUX plugin manager * Initialize TMUX plugin manager
#+BEGIN_SRC conf #+BEGIN_SRC conf
run '~/.tmux/plugins/tpm/tpm' run '~/.config/tmux/plugins/tpm/tpm'
#+END_SRC #+END_SRC
+1 -3
View File
@@ -9,9 +9,7 @@ set connect.host <<get-password(passname="ip/homelab")>>
set connect.port 9091 set connect.port 9091
set connect.tls false set connect.tls false
set connect.user tdehaeze set connect.user tdehaeze
set connect.host <<get-password(passname="nas/transmission")>> set connect.password <<get-password(passname="nas/transmission")>>
set connect.path /
set connect.url /transmission/
# Update torrent/peer/file/etc lists every 10 seconds # Update torrent/peer/file/etc lists every 10 seconds
set tui.poll 10 set tui.poll 10
+2 -3
View File
@@ -19,7 +19,7 @@ DOTFILES="${HOME}/.config/literate-dotfiles"
#+begin_src bash #+begin_src bash
echo "==> Neovim packages" echo "==> Neovim packages"
paru -S --needed neovim python-pynvim nodejs-neovim paru -S --needed --noconfirm neovim python-pynvim nodejs-neovim
#+end_src #+end_src
** vim-plug ** vim-plug
@@ -36,8 +36,7 @@ Tangle =vim.org= to generate =~/.config/nvim/init.vim=:
#+begin_src bash #+begin_src bash
echo "==> Tangling vim.org" echo "==> Tangling vim.org"
emacsclient -e "(org-babel-tangle-file \"${DOTFILES}/vim.org\")" \ emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/vim.org\")"
|| emacs --batch -l org --eval "(org-babel-tangle-file \"${DOTFILES}/vim.org\")"
#+end_src #+end_src
** Install Plugins ** Install Plugins
+1 -1
View File
@@ -99,7 +99,7 @@ tmpfile=/tmp/pdf_page.pdf
# Ideally would get the page from Zathura... # Ideally would get the page from Zathura...
# pagenum=$(rofi -dmenu -p "Page Number") # pagenum=$(rofi -dmenu -p "Page Number")
pdftk "$1" cat $2 output "$tmpfile.pdf" && \ qpdf --pages "$1" "$2" -- "$1" "$tmpfile.pdf" && \
pdf2svg "$tmpfile.pdf" "$tmpfile.svg" && \ pdf2svg "$tmpfile.pdf" "$tmpfile.svg" && \
inkscape "$tmpfile.svg" inkscape "$tmpfile.svg"
#+end_src #+end_src