Add a Dock menu and a menu bar volume slider #16

Merged
erdoar merged 3 commits from claude/dock-and-menubar into main 2026-10-10 16:58:11 +00:00
erdoar commented 2026-10-10 04:49:35 +00:00 (Migrated from github.com)

Stacked on erdoar/plug#15 (presets), which is stacked on erdoar/plug#14 (master knob). Merge #14, then #15, then this.

Summary

  • Dock menu: right-click Plug's Dock icon for Start/Stop, the current master level, and level steps (+10, +6, +3, 0, −3, −6, −12, −24 dB, Mute), with the nearest one ticked. The Dock only shows plain menu items, so there's no slider here.
  • Menu bar volume: a gauge icon in the menu bar opens a small panel with a master slider (speaker icons at each end), the level in dB, a 0 dB button, Start/Stop, Open Plug and Quit. It saves when you let go of the slider.
  • All three move the same master as the knob and MIDI. The model now lives in the app delegate (created lazily on first use), so the window, Dock menu and menu bar share it.
  • MasterVolume.position(forDecibels:) reverses the knob's taper, so the Dock steps land exactly on their dB.

Tested

  • Linux, Swift 6.0.3: 35 tests pass, including a new round-trip test of dB ↔ knob position for every Dock step.
  • The macOS files pass a syntax-only parse. Not compiled or tried yet.

To test on the Mac

  1. Quit Plug, then run scripts/bundle.sh --open.
  2. Right-click the Dock icon. Start/Stop should work, and picking a level should move the master knob, with the tick following.
  3. Click the gauge icon in the menu bar. Dragging the slider should move the knob and change the level, and 0 dB should snap back. Close the window and use Open Plug to bring it back.

🤖 Generated with Claude Code

https://claude.ai/code/session_011C96TJ2L7nzVMFTH7raNu5


Generated by Claude Code

Stacked on erdoar/plug#15 (presets), which is stacked on erdoar/plug#14 (master knob). Merge #14, then #15, then this. ## Summary - **Dock menu:** right-click Plug's Dock icon for **Start/Stop**, the current master level, and level steps (+10, +6, +3, 0, −3, −6, −12, −24 dB, Mute), with the nearest one ticked. The Dock only shows plain menu items, so there's no slider here. - **Menu bar volume:** a gauge icon in the menu bar opens a small panel with a **master slider** (speaker icons at each end), the level in dB, a **0 dB** button, **Start/Stop**, **Open Plug** and **Quit**. It saves when you let go of the slider. - All three move the same master as the knob and MIDI. The model now lives in the app delegate (created lazily on first use), so the window, Dock menu and menu bar share it. - `MasterVolume.position(forDecibels:)` reverses the knob's taper, so the Dock steps land exactly on their dB. ## Tested - Linux, Swift 6.0.3: 35 tests pass, including a new round-trip test of dB ↔ knob position for every Dock step. - The macOS files pass a syntax-only parse. **Not compiled or tried yet.** ## To test on the Mac 1. Quit Plug, then run `scripts/bundle.sh --open`. 2. Right-click the Dock icon. Start/Stop should work, and picking a level should move the master knob, with the tick following. 3. Click the gauge icon in the menu bar. Dragging the slider should move the knob and change the level, and 0 dB should snap back. Close the window and use **Open Plug** to bring it back. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011C96TJ2L7nzVMFTH7raNu5 --- _Generated by [Claude Code](https://claude.ai/code/session_011C96TJ2L7nzVMFTH7raNu5)_
Sign in to join this conversation.
No description provided.