Various config tweaks

This commit is contained in:
Ian Keane 2026-08-02 12:41:30 -04:00
parent b18f5056b3
commit 901d74e8b2
13 changed files with 105 additions and 4 deletions

27
scripts/pinentry-smart Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
# pinentry-smart: use pinentry-curses normally, but fall back to pinentry-tty
# when another TUI (e.g. senpai) already owns the terminal/ncurses context.
#
# Detection: walk up the process tree. If we find a known TUI app before
# reaching a shell or login, assume the terminal is taken.
is_tui_parent() {
local pid="$PPID"
local tui_apps="senpai mutt neomutt irssi weechat ncmpcpp ranger vifm"
for _ in $(seq 1 10); do
[[ -z "$pid" || "$pid" -le 1 ]] && break
local cmd
cmd=$(ps -o comm= -p "$pid" 2>/dev/null)
for app in $tui_apps; do
[[ "$cmd" == "$app" ]] && return 0
done
pid=$(ps -o ppid= -p "$pid" 2>/dev/null | tr -d ' ')
done
return 1
}
if is_tui_parent; then
exec /usr/bin/pinentry-tty "$@"
else
exec /usr/bin/pinentry-curses "$@"
fi