A lightweight macOS status bar chess clock built with pure Swift.
- Status Bar Integration: Runs in the macOS status bar with real-time display showing "W" for Work mode or "N" for Not Work mode
- Count-Up Timer: Tracks time spent in Work and Not Work modes (both count up from their current values)
- Flexible Time Input: Supports formats like
8h,5m,30sfor setting/adjusting times - Clock-based Timing: Uses actual system clock for accurate timing
- Persistent Storage: Saves configuration to
~/.config/chess_clock/ - No Dependencies: Pure Swift using built-in macOS frameworks
chmod +x install.sh
./install.shThis will:
- Compile the app
- Install to
~/Applications/ChessClock - Optionally add to Login Items (auto-start at boot)
chmod +x ChessClock.swift
swift ChessClock.swiftThe ⏱ icon will appear in your status bar!
# Compile
swiftc ChessClock.swift -o ChessClock
# Run
./ChessClock# Create app structure
mkdir -p ChessClock.app/Contents/MacOS
# Compile
swiftc ChessClock.swift -o ChessClock.app/Contents/MacOS/ChessClock
# Create Info.plist
cat > ChessClock.app/Contents/Info.plist << 'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>ChessClock</string>
<key>CFBundleIdentifier</key>
<string>com.chessclock.app</string>
<key>CFBundleName</key>
<string>ChessClock</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>LSUIElement</key>
<true/>
</dict>
</plist>
EOF
# Run
open ChessClock.app- ⌃⌘P - Start/Pause (Ctrl+Cmd+P)
- ⌃⌘W - Switch to Work mode (and auto-start)
- ⌃⌘N - Switch to Not Work mode (and auto-start)
- ⌘Q - Quit
For system-wide shortcuts (working even when other apps are focused):
- Go to System Settings > Privacy & Security > Accessibility
- Add ChessClock (or Terminal if running via Swift)
- Enable it
- Click the clock icon (⏱) in the status bar
- Select "Start/Pause" to begin timing
- The current mode's time displays in the status bar as "W ⏱ 00:00:00" or "N ⏱ 00:00:00"
- Click "Work" in the menu to switch to work mode (automatically starts the timer)
- Click "Not work" in the menu to switch to not work mode (automatically starts the timer)
- The currently active mode is marked with ► in the menu
- Use keyboard shortcuts ⌃⌘W (Work) or ⌃⌘N (Not work) for quick switching
- Click "Set Times..." in the menu
- The dialog shows current times - edit as needed (e.g.,
8h, 8hor5m, 10mor0, 0) - Supported formats:
8h- 8 hours30m- 30 minutes45s- 45 seconds0- zero/reset to 0
- Use this to adjust times mid-session if you accidentally ran the clock too long or need to correct the times
Both Work and Not Work modes always count up from their current values.
The clock uses wall-clock time, so it correctly handles system sleep:
- If your Mac goes to sleep while the timer is running, the timer continues counting
- When your Mac wakes up, the display immediately updates to show the correct elapsed time
- Example: Start timer at 10:00, Mac sleeps at 10:05, wakes at 11:05 → timer shows 1 hour has passed
- Work: 00:00:00: Shows work time; click to switch to work mode (auto-starts timer)
- Not work: 00:00:00: Shows not work time; click to switch to not work mode (auto-starts timer)
- Start/Pause: Toggle the timer (⌃⌘P)
- Set Times...: Adjust current times or set new times
- Reset to Default (0/0): Reset both timers to 0/0
- Shortcuts: Menu section showing available keyboard shortcuts
- Quit: Exit the application (⌘Q)
Note: The active mode is marked with ► next to it.
Stored in ~/.config/chess_clock/:
config.json: Current configuration (times, active mode)
Note: The application automatically saves state:
- Every minute while running
- When pausing the timer
- When switching modes
- When quitting the application
- After the system wakes from sleep
Set Times: 0, 0
Set Times: 5m, 10m
Set Times: 2h, 30m
- Written in pure Swift
- Uses Cocoa/AppKit frameworks (built into macOS)
- Updates every 0.1 seconds
- Wall-clock based timing - correctly handles system sleep/wake
- JSON serialization for saving state
- Runs as accessory app (no dock icon)
- Auto-saves every minute while running
- Listens for system wake notifications to update immediately
- Binary size: ~130KB (lightweight native code)
chmod +x uninstall.sh
./uninstall.shThis will remove the app and optionally remove saved times.
Or manually:
# Stop auto-start
launchctl unload ~/Library/LaunchAgents/com.chessclock.app.plist
# Remove files
rm ~/Applications/ChessClock
rm ~/Library/LaunchAgents/com.chessclock.app.plist
rm -rf ~/.config/chess_clock # Optional: removes saved times- macOS 10.13+ (High Sierra or later)
- Swift compiler (included with Xcode or Command Line Tools)
Install Xcode Command Line Tools:
xcode-select --installThe app automatically creates ~/.config/chess_clock/ on first run.
Run from terminal to see error messages:
swift ChessClock.swiftThis project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
Copyright (C) 2025 Jonathan Bisson