# TickMato 滴答番茄 > macOS 守护脚本:监控 TickTick 番茄钟状态,自动驱动 TickMato 浮窗 ## Install Save as a script file and run: #!/bin/bash # PomodoroSync Daemon — 滴答番茄同步守护进程 # 监控 TickTick 番茄钟状态,自动驱动 TickMato 浮窗 # 用法:nohup bash ~/Scripts/pomodoro-sync-daemon.sh > /tmp/pomodoro-sync.log 2>&1 & WAS_RUNNING=false echo "🍅 PomodoroSync 已启动,正在后台监控 TickTick 番茄钟..." while true; do STATE=$(osascript -e ' tell application "System Events" if not (exists process "TickTick") then return "no_ticktick" tell process "TickTick" set allTexts to every static text of window 1 set output to "" repeat with txt in allTexts try set output to output & (value of txt as text) & "|" end try end repeat return output end tell end tell' 2>&1) if echo "$STATE" | grep -q "番茄专注"; then TIMER=$(echo "$STATE" | sed 's/.*番茄专注|//' | cut -d'|' -f1) if [ -n "$TIMER" ] && [ "$TIMER" != "25:00" ] && [ "$WAS_RUNNING" = "false" ]; then # TickTick 开始计时 → 启动 TickMato echo "$(date +%H:%M:%S) ⏰ 检测到番茄钟启动 ($TIMER)" WAS_RUNNING=true /Users/shiny/Scripts/TickMato --autostart & elif [ "$TIMER" = "25:00" ] && [ "$WAS_RUNNING" = "true" ]; then # TickTick 回到 25:00 → 用户手动结束了 echo "$(date +%H:%M:%S) ⏹ 检测到番茄钟手动结束" WAS_RUNNING=false /Users/shiny/Scripts/TickMato --stop & fi fi sleep 2 done --- Source: https://tokrepo.com/en/workflows/tickmato-aee7e527 Author: shiny.lucc