remove(hyprlock): typewriter for revise
This commit is contained in:
@@ -1,61 +1,10 @@
|
|||||||
{ config, pkgs, ... }:
|
{
|
||||||
let
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
cacheWallpaper = "${config.home.homeDirectory}/.cache/current_wallpaper";
|
cacheWallpaper = "${config.home.homeDirectory}/.cache/current_wallpaper";
|
||||||
clockFont = "JetBrains Mono";
|
clockFont = "JetBrains Mono";
|
||||||
|
|
||||||
typewriter = pkgs.writeShellScript "hyprlock-typewriter" ''
|
|
||||||
text="おはよう"
|
|
||||||
state_file="/tmp/hyprlock_typewriter"
|
|
||||||
lock_pid="/tmp/hyprlock_pid"
|
|
||||||
blink_file="/tmp/hyprlock_blink"
|
|
||||||
|
|
||||||
# Get current hyprlock PID
|
|
||||||
current_pid=$(pgrep -x hyprlock | head -1)
|
|
||||||
|
|
||||||
# Reset if this is a new hyprlock session
|
|
||||||
if [ -f "$lock_pid" ]; then
|
|
||||||
old_pid=$(cat "$lock_pid")
|
|
||||||
if [ "$current_pid" != "$old_pid" ]; then
|
|
||||||
rm -f "$state_file" "$blink_file"
|
|
||||||
echo "$current_pid" > "$lock_pid"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "$current_pid" > "$lock_pid"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Initialize position
|
|
||||||
if [ ! -f "$state_file" ]; then
|
|
||||||
echo 0 > "$state_file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
pos=$(cat "$state_file")
|
|
||||||
len=''${#text}
|
|
||||||
|
|
||||||
# Increment position only if not complete
|
|
||||||
if [ "$pos" -lt "$len" ]; then
|
|
||||||
pos=$((pos + 1))
|
|
||||||
echo "$pos" > "$state_file"
|
|
||||||
echo "''${text:0:$pos}_"
|
|
||||||
else
|
|
||||||
# Blink cursor via foreground color toggle (slow blink)
|
|
||||||
if [ ! -f "$blink_file" ]; then
|
|
||||||
echo "0 0" > "$blink_file"
|
|
||||||
fi
|
|
||||||
read -r blink count < "$blink_file"
|
|
||||||
count=$((count + 1))
|
|
||||||
# Toggle every 5 updates (~600ms at 120ms interval)
|
|
||||||
if [ "$count" -ge 5 ]; then
|
|
||||||
count=0
|
|
||||||
blink=$((1 - blink))
|
|
||||||
fi
|
|
||||||
echo "$blink $count" > "$blink_file"
|
|
||||||
if [ "$blink" -eq 0 ]; then
|
|
||||||
echo "''${text}_"
|
|
||||||
else
|
|
||||||
echo "''${text}<span fgalpha=\"1\">_</span>"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
in {
|
in {
|
||||||
programs.hyprlock = {
|
programs.hyprlock = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -80,10 +29,10 @@ in {
|
|||||||
# Typewriter greeting (above clock)
|
# Typewriter greeting (above clock)
|
||||||
label {
|
label {
|
||||||
monitor =
|
monitor =
|
||||||
text = cmd[update:200] ${typewriter}
|
text = Hello World!
|
||||||
color = $on_surface_variant
|
color = $on_surface_variant
|
||||||
font_size = 24
|
font_size = 24
|
||||||
font_family = ${clockFont}
|
font_family = ${clockFont} Bold
|
||||||
position = 0, 200
|
position = 0, 200
|
||||||
halign = center
|
halign = center
|
||||||
valign = center
|
valign = center
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
{pkgs, ...}: let
|
||||||
|
in {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user