feat: add CLI and scripting support#141
Merged
karbassi merged 1 commit intomichaelvillar:masterfrom Feb 7, 2026
Merged
Conversation
…ript, CLI) Add four ways to control the timer programmatically: - URL scheme: open "timer://5", open "timer://2.5", open "timer://2:30?window=2" - Launch args: open -a Timer --args 5 --window 2 - AppleScript: tell app "Timer" to start timer "5" window 2 - CLI wrapper: ./timer-cli 5 -w 2 (thin shell script over URL scheme) Commands: start (duration), stop, reset, pause, new. Time formats: "5" (5 min), "2.5" (2m30s fractional), "2:30" (2m30s colon). Multi-window: optional window parameter (1-based) targets specific timers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #51, closes #105.
Summary
timer://) to control the timer programmatically — e.g.open "timer://5",open "timer://2:30?window=2"open -a Timer --args 5 --window 2.sdef) — e.g.tell app "Timer" to start timer "5" window 2timer-cli) as a thin shell script over the URL scheme — e.g../timer-cli 5 -w 2Commands
<duration>5= 5 min,2.5= 2m30s,2:30= 2m30s)stopresetpausenewAll commands accept an optional window parameter (1-based) to target a specific timer when multiple windows are open.
Files changed
Timer/AppDelegate.swift— URL handler, launch args parser, command router, time input parserTimer/MVClockView+Behavior.swift—startTimer(seconds:)methodTimer/MVTimerController.swift— exposeclockViewfor programmatic accessTimer/Info.plist— URL scheme registration, AppleScript enabledTimer/Timer.sdef— scripting definition (start/stop/pause/reset/new)Timer/TimerScriptCommand.swift—NSScriptCommandsubclassTimer.xcodeproj/project.pbxproj— add new files to targettimer-cli— shell script CLI wrapperMakefile—install-clitargetTest plan
make build— clean build, no errorsmake lint— 0 violationsmake test— all tests passopen "timer://5"— starts 5-minute timeropen "timer://2.5"— starts 2m30s timeropen "timer://2:30"— starts 2m30s timeropen "timer://stop",open "timer://reset",open "timer://pause"open "timer://new"— opens new timer windowopen "timer://5?window=2"— targets second windowopen -a Timer --args 5— starts via launch argstell application "Timer" to start timer "2"./timer-cli 5— starts via CLI wrapper