Files
scripts-bash/timer_module.sh
2026-03-30 15:48:25 -06:00

23 lines
385 B
Bash
Executable File

#!/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"