From bde84587b2a408970086f4c708ac9a629abfa554 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 18 Jul 2026 14:27:58 +0530 Subject: feat: switch launcher to dex, add vi-mode and kitty nav, enable ouch unfree Rewrite fzf-launcher to use dex via setsid instead of parsing Exec= lines Add vi-mode (bindkey -v, KEYTIMEOUT=1) to zsh Add Ctrl+click link handling and Ctrl+Shift+h/j/k/l window nav to kitty Switch i3 terminal key from $mod+t to $mod+Return Enable unRAR support in ouch (override enableUnfree) Fix epub cover extraction (decompress full archive, use find) Remove neomutt dd/gT keybindings Fix missing $TITLE quoting in neomutt-sync Add findutils and dex to script deps --- modules/scripts/default.nix | 2 ++ modules/scripts/file-preview.sh | 6 ++++-- modules/scripts/fzf-launcher.sh | 29 +++++++---------------------- modules/scripts/neomutt-sync.sh | 4 ++-- 4 files changed, 15 insertions(+), 26 deletions(-) (limited to 'modules/scripts') diff --git a/modules/scripts/default.nix b/modules/scripts/default.nix index a2d9e1a..789c32d 100644 --- a/modules/scripts/default.nix +++ b/modules/scripts/default.nix @@ -65,6 +65,7 @@ let config.file-management.ouch.package pkgs.coreutils pkgs.file + pkgs.findutils pkgs.fontconfig pkgs.librsvg pkgs.antiword @@ -107,6 +108,7 @@ let path = ./fzf-launcher.sh; deps = [ config.terminal.fzf.package + pkgs.dex pkgs.util-linux ]; conditions = [ diff --git a/modules/scripts/file-preview.sh b/modules/scripts/file-preview.sh index 047252d..7712754 100644 --- a/modules/scripts/file-preview.sh +++ b/modules/scripts/file-preview.sh @@ -93,8 +93,10 @@ case "$MIMETYPE" in application/epub+zip|application/x-mobipocket-ebook) TMP_IMG="$TMP_DIR/epub-${INODE}.png" if [ ! -f "$TMP_IMG" ]; then - ouch decompress "$FILE_PATH" --limit "*/cover*.jpg" --dir "$TMP_DIR" >/dev/null 2>&1 - mv "$TMP_DIR"/cover*.jpg "$TMP_IMG" 2>/dev/null + EPUB_DIR="$TMP_DIR/epub-${INODE}" + ouch decompress --yes --dir "$EPUB_DIR" "$FILE_PATH" >/dev/null 2>&1 + COVER=$(find "$EPUB_DIR" -type f \( -iname 'cover*.jpg' -o -iname 'cover*.jpeg' -o -iname 'cover*.png' \) -print -quit) + [ -n "$COVER" ] && cp "$COVER" "$TMP_IMG" fi [ -s "$TMP_IMG" ] && render_image "$TMP_IMG" ;; diff --git a/modules/scripts/fzf-launcher.sh b/modules/scripts/fzf-launcher.sh index 5ae3d95..0858078 100644 --- a/modules/scripts/fzf-launcher.sh +++ b/modules/scripts/fzf-launcher.sh @@ -1,55 +1,41 @@ # Fzf-launcher - FZF-based application launcher (scans .desktop files) + DIRS=( /run/current-system/sw/share/applications "$HOME/.nix-profile/share/applications" "$HOME/.local/share/applications" ) -entries="" +shopt -s nullglob +entries="" for dir in "${DIRS[@]}"; do [[ -d "$dir" ]] || continue - - shopt -s nullglob for f in "$dir"/*.desktop; do [[ -f "$f" ]] || continue - # Skip hidden entries grep -q "^NoDisplay=true" "$f" && continue grep -q "^Hidden=true" "$f" && continue - - # Only GUI apps grep -q "^Type=Application" "$f" || continue grep -q "^Terminal=true" "$f" && continue - # Skip ONLY actual junk categories (not System!) categories=$(grep -m1 "^Categories=" "$f" | cut -d= -f2-) if [[ -n "$categories" ]]; then echo "$categories" | grep -qE "(Settings|Screensaver|DesktopSettings)" && continue fi - # Get name (handle localized fallback) name=$(grep -m1 "^Name=" "$f" | cut -d= -f2-) if [[ -z "$name" ]]; then name=$(grep -m1 -E "^Name\[.*\]=" "$f" | cut -d= -f2-) fi + [[ -z "$name" ]] && continue - # Get exec - exec=$(grep -m1 "^Exec=" "$f" | cut -d= -f2-) - - [[ -z "$name" || -z "$exec" ]] && continue - - # Remove field codes like %U %F etc. - exec=$(echo "$exec" | sed -E 's/ ?%[a-zA-Z]//g') - - entries+="$name"$'\t'"$exec"$'\n' + entries+="$name"$'\t'"$f"$'\n' done done -# Deduplicate + sort entries=$(printf '%s' "$entries" | sort -fu -t$'\t' -k1,1) -# FZF selection chosen=$(printf '%s' "$entries" | fzf \ --prompt='Launch: ' \ --layout=reverse \ @@ -59,7 +45,6 @@ chosen=$(printf '%s' "$entries" | fzf \ [[ -z "$chosen" ]] && exit 0 -exec_cmd=$(printf '%s' "$chosen" | cut -d$'\t' -f2) +desktop_file=$(printf '%s' "$chosen" | cut -d$'\t' -f2-) -# Launch safely -eval "$exec_cmd" &>/dev/null & +setsid -f dex "$desktop_file" /dev/null 2>&1 diff --git a/modules/scripts/neomutt-sync.sh b/modules/scripts/neomutt-sync.sh index 1adbc7f..e5aae34 100644 --- a/modules/scripts/neomutt-sync.sh +++ b/modules/scripts/neomutt-sync.sh @@ -52,12 +52,12 @@ EOF # --- PHASE 2: notmuch --- printf "XXX\n100\nIndexing new mail with notmuch...\nXXX\n" notmuch new > "$NOTMUCH_LOG" 2>&1 -) | dialog --title $TITLE --gauge "Initializing..." 8 80 0 +) | dialog --title "$TITLE" --gauge "Initializing..." 8 80 0 # 3. Format the captured notmuch output into a single clean line CLEAN_OUT=$(tr '\n' ' ' < "$NOTMUCH_LOG" | sed 's/ */ /g') # 4. Display final results and wait for user input (Enter/Esc) to dismiss -dialog --title $TITLE --msgbox "Done!\n$CLEAN_OUT" 8 80 +dialog --title "$TITLE" --msgbox "Done!\n$CLEAN_OUT" 8 80 clear -- cgit v1.2.3