add(hyprlock): now use 50 languages

This commit is contained in:
kenji
2026-01-05 22:01:52 -06:00
parent 7bc837aeaf
commit 1f3c44afb7
4 changed files with 98 additions and 25 deletions
+69 -8
View File
@@ -1,16 +1,77 @@
{pkgs, ...}: let
hakase-hyprlock-text-generator = pkgs.writeShellScriptBin "hakase-hyprlock-text-generator" ''
hour=$(date +%H)
name="$USER"
cache_file="''${XDG_RUNTIME_DIR:-/tmp}/hyprlock_greeting"
pid_file="''${XDG_RUNTIME_DIR:-/tmp}/hyprlock_greeting_pid"
if [[ $hour -lt 12 ]]; then
greeting=""
elif [[ $hour -lt 18 ]]; then
greeting=""
else
greeting=""
current_pid=$(pgrep -x hyprlock | head -1)
# Pick new greeting only when hyprlock restarts
if [[ -f $pid_file && -f $cache_file ]]; then
old_pid=$(cat "$pid_file")
if [[ "$old_pid" == "$current_pid" ]]; then
cat "$cache_file"
exit 0
fi
fi
greetings=(
"Hello"
"Hola"
"Bonjour"
"Hallo"
"Ciao"
"Olá"
"Привет"
""
""
""
"مرحبا"
"שלום"
""
""
"Γειά σου"
"Merhaba"
"Xin chào"
"Cześć"
"Hej"
"Ahoj"
"Szia"
"Salut"
"Привіт"
""
""
"Jambo"
"Aloha"
"Sawubona"
"Habari"
"Hei"
"Hallå"
"Hei"
"Kamusta"
"Salam"
"Selamat"
"Saluton"
"Tere"
"Sveiki"
"Labas"
"Здраво"
"Здравей"
"Bok"
"Përshëndetje"
"Բdelays"
""
"Сайн уу"
""
""
""
""
)
idx=$((RANDOM % ''${#greetings[@]}))
greeting="''${greetings[$idx]}"
echo "$current_pid" > "$pid_file"
echo "$greeting" > "$cache_file"
echo "$greeting"
'';
in {
+1 -1
View File
@@ -37,7 +37,7 @@
echo "''${text:0:$letter}_"
else
# Toggle every 4 calls (at 200ms update = ~800ms blink)
if (((blink / 20) % 2 == 0)); then
if (((blink / 4) % 2 == 0)); then
echo "''${text}_"
else
echo "''${text}<span alpha=\"1%\">_</span>"