Skip to content

feat: notifications for new tracks - #5

Merged
parda21 merged 1 commit into
feat/macos-calmfrom
feat/track-notifications
Oct 15, 2026
Merged

parda21 merged 1 commit into
feat/macos-calmfrom
feat/track-notifications

Conversation

@yk-sgr

@yk-sgr yk-sgr commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Stacked on #4.

This one works at the terminal level, so it's shared code: it works the same on Linux.

What changes

While cloofy's window is in the background, each new track shows a desktop notification with its title, artists and album. The terminal posts it, so:

  • cloofy needs no notification permission or app bundle of its own (the bundle can come later, with the icon);
  • clicking the notification leads back to the right terminal window.
Terminal Sequence
kitty OSC 99, title and body base64 encoded, o=unfocused. A fixed i=cloofy makes each new track replace the last notification (kitty 0.36+).
Ghostty, WezTerm OSC 777 notify;title;body
iTerm2 OSC 9, one line
others (e.g. Terminal.app) nothing
  • Detection also uses the variables terminals export into their shells (KITTY_WINDOW_ID, GHOSTTY_RESOURCES_DIR, WEZTERM_PANE, ITERM_SESSION_ID), so it still works inside tmux, where TERM_PROGRAM is tmux.
  • tmux: the sequence is wrapped for passthrough, which needs set -g allow-passthrough on.
  • Focus: cloofy turns on focus reporting (EnableFocusChange) and stays quiet where the terminal doesn't report focus.
  • No flooding: only cloofy's own playback, only after a track played for 1.5 s, so skipping through stays quiet. That also keeps it under Ghostty's limit of one notification per second.
  • Configurable: notifications = false in config.toml turns them off.

Verified

  • 5 unit tests: announcing once a track settles, silence while in front (and for that track afterwards), waiting while paused, each terminal's sequence, and escaping plus the tmux wrapping.
  • The TUI starts and quits normally with focus reporting on.
  • I couldn't see a real notification from here: that needs a terminal window that can lose focus.

To test by hand

  • In Ghostty, kitty or WezTerm: play, switch to another app, wait for the next track: a notification shows; clicking it brings the terminal back
  • With cloofy in front, nothing shows
  • notifications = false: nothing shows

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d2d7994b-770f-49fb-b91b-3a9fc0db3837

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yk-sgr
yk-sgr force-pushed the feat/track-notifications branch from 0d7293f to ffa05c0 Compare October 15, 2026 14:02
While cloofy's window is in the background, each new track shows a
desktop notification with its title, artists and album. The terminal
posts it, so cloofy needs no notification permission or app bundle of
its own, and a click leads back to the right window. This works the same
on Linux.

- kitty gets OSC 99: title and body, base64 encoded, and each new track
  replaces the last notification. Ghostty and WezTerm get OSC 777.
  iTerm2 gets OSC 9 as a single line. Other terminals get nothing.
- Inside tmux the sequence is wrapped for passthrough, which tmux sends
  on with `allow-passthrough on`.
- cloofy turns on focus reporting to know when it is in the background,
  and stays quiet where the terminal doesn't report focus.
- Only cloofy's own playback, only after a track played for 1.5 s, so
  skipping through doesn't flood. A track that started while cloofy was
  in front isn't announced later.
- `notifications = false` in config.toml turns them off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@yk-sgr
yk-sgr force-pushed the feat/track-notifications branch from ffa05c0 to 97380b7 Compare October 15, 2026 14:47
@parda21
parda21 merged commit 97380b7 into feat/macos-calm Oct 15, 2026
3 checks passed
@parda21

parda21 commented Oct 15, 2026

Copy link
Copy Markdown
Owner

Merged through #7, unchanged. Fixed on top:

  • 3a398b7: the body leaves out missing parts, so an episode no longer reads "Show · ", plus a test.
  • c2b2b6a: tmux's defaults block notifications (focus-events off, and allow-passthrough on only covers panes in view), so the README and CHANGELOG now name focus-events on and allow-passthrough all.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants