Files
dotfiles/.config/waybar/scripts/pomodoro-preset.sh
2026-03-08 14:37:55 +00:00

34 lines
608 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
STATE_FILE="/tmp/pomodoro-preset"
if ! command -v waybar-module-pomodoro >/dev/null 2>&1; then
echo "Error: waybar-module-pomodoro is not installed or not in PATH." >&2
exit 1
fi
current="A"
if [[ -f "$STATE_FILE" ]]; then
read -r current < "$STATE_FILE" || current="A"
fi
if [[ "$current" == "A" ]]; then
next="B"
work=50
short=10
long=20
else
next="A"
work=25
short=5
long=15
fi
waybar-module-pomodoro set-work "$work"
waybar-module-pomodoro set-short "$short"
waybar-module-pomodoro set-long "$long"
printf '%s\n' "$next" > "$STATE_FILE"