first commit
This commit is contained in:
22
timer_module.sh
Executable file
22
timer_module.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
STATE_FILE="/tmp/waybar_timer"
|
||||
|
||||
if [ ! -f "$STATE_FILE" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
end_time=$(cat "$STATE_FILE")
|
||||
now=$(date +%s)
|
||||
remaining=$((end_time - now))
|
||||
|
||||
if [ "$remaining" -le 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Formateamos tiempo como MM:SS
|
||||
minutes=$((remaining / 60))
|
||||
seconds=$((remaining % 60))
|
||||
|
||||
printf '{"text": "⏳ %02d:%02d", "tooltip": "Timer"}\n' "$minutes" "$seconds"
|
||||
|
||||
Reference in New Issue
Block a user