Skip to content

Add a native now-playing provider with playback controls #209

Closed

Description

@Seb-GRAF

Problem

The store's now-playing package shows the track from Music or Spotify with controls. It's a stream script in JavaScript for Automation, plus a shell script that runs osascript for each control. So it:

  • is a package that runs commands, which a maintainer must review for each version;
  • reads the position through Apple Events every second while a track plays;
  • covers only Music and Spotify, not Podcasts, browsers or other players that the macOS Now Playing menu shows.

Barik and simple-bar have a now-playing widget built in, Waybar has mpris, and zebar had a request for one (zebar #73, 22 reactions).

Proposal

  • A nowPlaying provider: text is the title, with fields.title, fields.artist, fields.album, fields.player, fields.playing (true or false), fields.artwork (a file path or URL for image blocks), and values.position, values.duration and values.progress (0–1). It sends a nowPlayingChange event.
  • Actions for play/pause, next and previous that need no shell, so a package of "kind": "widgets" can offer controls.
  • It updates when the player posts a change and reads the position only while something shows it, for example while the popup is open.
  • Its registry entry declares Automation access for each player, so setup lists it.

How it reads players is the open question:

  1. Per-app Apple Events, public. Music posts com.apple.Music.playerInfo and Spotify com.spotify.client.PlaybackStateChanged as distributed notifications; Scripting Bridge or NSAppleScript reads the track and sends controls. It needs NSAppleEventsUsageDescription and Automation access for each app, and covers only players with a scripting dictionary. This is what the package does today, moved in-process.
  2. MediaRemote, private. It covers every player the system knows. macOS 15.4 restricted the private MediaRemote framework to Apple processes. mediaremote-adapter works around this by loading a helper framework into /usr/bin/perl, which keeps the entitlement. That conflicts with StableBar's public-API stance and could break in any macOS update. Reports on macOS 26 are mixed: reading works, and sending commands worked for some users and not others. I could not verify it on macOS 26 myself.

Option 1 fits the project; option 2 would need an explicit exception, as the opt-in macOS Spaces source has.

Possible today

Yes, for Music and Spotify, through the store's now-playing package, which runs scripts and needs Automation access. Other players need a script built on a third-party tool such as media-control.

Related

Triaged by Claude Code via T3 Code (Claude Opus 5.5).

Activity

  1. added
    enhancement
    on Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions