Install the lock screen PAM stack and replace the missing screensaver effects

This commit is contained in:
2026-09-21 01:07:34 +00:00
parent 64afc07250
commit d316308bf5
10 changed files with 70 additions and 10 deletions
+2 -1
View File
@@ -2,7 +2,8 @@
# blob:summary=Launch the Blob screensaver in the default terminal on the system with the correct font configuration.
if blob-cmd-missing ttfx; then
if ! blob-screensaver-effect >/dev/null; then
blob-notify-send -g ✋ "Screensaver needs ttfx or tte" "Install python-terminaltexteffects."
exit 1
fi
+28 -5
View File
@@ -2,13 +2,37 @@
# blob:summary=Run the Blob screensaver using random effects from TTE.
effect_command=$(blob-screensaver-effect) || exit 1
effect_args() {
local input="$HOME/.config/blob/branding/screensaver.txt"
if [[ $effect_command == "ttfx" ]]; then
printf '%s\n' -i "$input" --frame-rate 120 --canvas-width 0 --canvas-height 0 \
--reuse-canvas --anchor-canvas c --anchor-text c --random-effect --no-eol \
--no-restore-cursor
return 0
fi
local effects=(
beams binarypath blackhole bouncyballs bubbles burn colorshift crumble
decrypt errorcorrect expand fireworks middleout orbittingvolley overflow
pour print rain randomsequence rings scattered slice slide spotlights
spray swarm sweep synthgrid unstable vhstape waves wipe
)
printf '%s\n' -i "$input" --frame-rate 120 --canvas-width 0 --canvas-height 0 \
--anchor-canvas c --anchor-text c --no-color \
"${effects[RANDOM % ${#effects[@]}]}"
}
screensaver_in_focus() {
hyprctl activewindow -j | jq -e '.class == "org.blob.screensaver"' >/dev/null 2>&1
}
exit_screensaver() {
hyprctl eval 'hl.config({ cursor = { invisible = false } })' &>/dev/null || hyprctl keyword cursor:invisible false &>/dev/null || true
pkill -x ttfx 2>/dev/null
pkill -x "$effect_command" 2>/dev/null
pkill -f '[o]rg.blob.screensaver' 2>/dev/null
exit 0
}
@@ -36,11 +60,10 @@ wait_for_terminal_resize() {
wait_for_terminal_resize
while true; do
ttfx -i ~/.config/blob/branding/screensaver.txt \
--frame-rate 120 --canvas-width 0 --canvas-height 0 --reuse-canvas --anchor-canvas c --anchor-text c\
--random-effect --no-eol --no-restore-cursor &
mapfile -t effect_arguments < <(effect_args)
"$effect_command" "${effect_arguments[@]}" &
while pgrep -t "${tty#/dev/}" -x ttfx >/dev/null; do
while pgrep -t "${tty#/dev/}" -x "$effect_command" >/dev/null; do
if read -n1 -t 1 || ! screensaver_in_focus; then
exit_screensaver
fi
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# blob:summary=Print the terminal text effects command the screensaver can use
# blob:hidden=true
for candidate in ttfx tte; do
if command -v "$candidate" &>/dev/null; then
printf '%s\n' "$candidate"
exit 0
fi
done
exit 1
+4 -3
View File
@@ -20,7 +20,8 @@ if pgrep -x "1password" >/dev/null && blob-cmd-present 1password; then
fi
# Avoid running screensaver when locked
pkill -x ttfx 2>/dev/null || true
# ttfx handles SIGTERM asynchronously, so keep its terminal alive until it exits.
timeout 1s pidwait -x ttfx 2>/dev/null || true
effect_command=$(blob-screensaver-effect 2>/dev/null) && {
pkill -x "$effect_command" 2>/dev/null || true
timeout 1s pidwait -x "$effect_command" 2>/dev/null || true
}
pkill -f '[o]rg.blob.screensaver' 2>/dev/null || true