add(hyprlock): now use 50 languages
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
general = {
|
||||
after_sleep_cmd = "hyprctl dispatch dpms on";
|
||||
ignore_dbus_inhibit = false;
|
||||
lock_cmd = "hyprlock";
|
||||
lock_cmd = "hakase-hyprlock";
|
||||
before_sleep_cmd = "loginctl lock-session"; # lock before suspend
|
||||
};
|
||||
|
||||
|
||||
+27
-15
@@ -6,16 +6,40 @@
|
||||
}: let
|
||||
cacheWallpaper = "${config.home.homeDirectory}/.cache/current_wallpaper";
|
||||
clockFont = myConfig.font.monospace;
|
||||
scriptFont = myConfig.font.monospaceScript;
|
||||
greetingConf = "${config.home.homeDirectory}/.cache/hyprlock-greeting.conf";
|
||||
|
||||
hakase-hyprlock = pkgs.writeShellScriptBin "hakase-hyprlock" ''
|
||||
# Get focused monitor
|
||||
monitor=$(hyprctl monitors -j | ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name')
|
||||
|
||||
# Generate greeting label config
|
||||
cat > ${greetingConf} << EOF
|
||||
label {
|
||||
monitor = $monitor
|
||||
text = cmd[update:200] hakase-hyprlock-typewriter "\$(hakase-hyprlock-text-generator)"
|
||||
color = \$on_surface_variant
|
||||
font_size = 120
|
||||
font_family = ${clockFont} Bold
|
||||
position = 0, 480
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
EOF
|
||||
|
||||
exec hyprlock "$@"
|
||||
'';
|
||||
in {
|
||||
imports = [
|
||||
./scripts/typewriter.nix
|
||||
./scripts/random-text.nix
|
||||
];
|
||||
home.packages = [hakase-hyprlock];
|
||||
programs.hyprlock = {
|
||||
# FIXME: `greeting` has as inconsistency in pos for different monitors
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
source = ~/.config/hypr/hyprlock-colors.conf
|
||||
source = ${greetingConf}
|
||||
|
||||
general {
|
||||
hide_cursor = true
|
||||
@@ -32,18 +56,6 @@ in {
|
||||
vibrancy = 0.2
|
||||
}
|
||||
|
||||
# Greeting (above clock)
|
||||
label {
|
||||
monitor = DP-1
|
||||
text = cmd[update:1000] hakase-hyprlock-text-generator
|
||||
color = $on_surface_variant
|
||||
font_size = 120
|
||||
font_family = ${clockFont} Bold
|
||||
position = 0, 480
|
||||
halign = center
|
||||
valign = center
|
||||
}
|
||||
|
||||
# Hours (top)
|
||||
label {
|
||||
monitor =
|
||||
@@ -71,10 +83,10 @@ in {
|
||||
# Date
|
||||
label {
|
||||
monitor =
|
||||
text = cmd[update:60000] date '+%A, %B %d'
|
||||
text = cmd[update:60000] echo "<span font_features='ss02'>$(date '+%A, %B %d')</span>"
|
||||
color = $on_surface_variant
|
||||
font_size = 18
|
||||
font_family = ${clockFont}
|
||||
font_family = ${clockFont} Italic
|
||||
position = 0, -320
|
||||
halign = center
|
||||
valign = center
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>"
|
||||
|
||||
Reference in New Issue
Block a user