Ranking|Claude Code Mods

ModsCode / Claude Code Mods / Ranking / now-playing

now-playing

Now Playing pane, status line and model tool for Apple Music and Spotify on macOS

Code you can checkTerminal + desktopPaneStatus lineToastBoxButtonText
runs programs, draws

What it does

  • Draws a pane, toasts
  • Adds /music
  • Watches mcp__now-playing__music calls and can refuse them
  • Hooks session.start, ui.close
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Has a desktop-specific branch
  • Handles errors

Code to start from

A starter ModsCode writes from the drawing it read, and the mod's own lines that draw, where there are any.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like now-playing by Jimmy Hsiao (pane, status, toast), as ModsCode read it from the mod's code:
// https://modscode.com/claude-mods/mods/fatmylin-now-playing/
// Written by ModsCode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Now Playing" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Button, Text } = $.ui.resolve(e)
    const label = '…'
    const i = '…'
    const formatTime = '…'
    const formatTime2 = '…'
    const repeat = '…'
    const volume = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" justifyContent="center">
          <Box flexDirection="row" columnGap={3}>
            <Button label={`${label} ♪`} hotkey={`${i}`} plain />
            <Button label={`${label} ♪`} hotkey={`${i}`} plain />
            <Button label={`${label} ♪`} hotkey={`${i}`} plain />
          </Box>
        </Box>
        <Box height={1} />
        <Box flexDirection="row" justifyContent="center" />
        <Box height={1} />
        <Box flexDirection="row" justifyContent="center">
          <Text bold />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text bold />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text bold />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text dimColor />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text dimColor />
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text dimColor />
        </Box>
        <Box height={1} />
        <Box flexDirection="row" justifyContent="center">
          <Text dimColor wrap="truncate-end">
            {" "}
          </Text>
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text bold wrap="truncate-end">
            {" "}
          </Text>
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text dimColor wrap="truncate-end">
            {" "}
          </Text>
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Text dimColor>
            No synced lyrics
          </Text>
        </Box>
        <Box height={1} />
        <Box flexDirection="row">
          <Text>
            ━━━━━━━━
          </Text>
          <Text bold>
            ╸
          </Text>
          <Text dimColor>
            ────────
          </Text>
        </Box>
        <Box flexDirection="row" justifyContent="space-between">
          <Text dimColor>
            {formatTime}
          </Text>
          <Text dimColor>
            {formatTime2}
          </Text>
        </Box>
        <Box height={1} />
        <Box flexDirection="row" justifyContent="center">
          <Box flexDirection="row" columnGap={4}>
            <Button label="⏮" hotkey="b" plain />
            <Button label="⏸" hotkey="k" plain />
            <Button label="⏭" hotkey="n" plain />
            <Button label="♥" hotkey="f" plain />
          </Box>
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Box flexDirection="row" columnGap={3}>
            <Box flexDirection="row" columnGap={1}>
              <Text>
                ●
              </Text>
              <Button label="⇄ Shuffle on" hotkey="s" plain />
              <Text>
                {" "}
              </Text>
            </Box>
            <Box flexDirection="row" columnGap={1}>
              <Text>
                ●
              </Text>
              <Button label={`↻ Repeat ${repeat}`} hotkey="r" plain />
            </Box>
          </Box>
        </Box>
        <Box flexDirection="row" justifyContent="center">
          <Box flexDirection="row" columnGap={1}>
            <Button label="−" hotkey="d" plain dimColor />
            <Text dimColor>
              {"vol "}
              {volume}
            </Text>
            <Button label="+" hotkey="u" plain dimColor />
            <Button label="lyrics off" hotkey="l" plain dimColor />
          </Box>
        </Box>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const app = '…'
    const stderr = '…'
    const what = '…'
    const error = '…'
    await $.ui.toast(`Could not open ${app}: ${stderr}`)
    await $.ui.toast(`${what} failed: ${error}`)
    return next(e)
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

plugins/now-playing/hooks/register.tsx lines 641–764 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const players = await read($, playersAtom)
    const active = await read($, trackAtom)
    const picked = await read($, sourceAtom)
    const covers = await read($, coversAtom)
    const artMode = await read($, artModeAtom)
    await read($, tickAtom) // subscribes the pane to the 1 s redraw
    const lyricsOn = await read($, lyricsOnAtom)
    await read($, lyricsRevAtom) // redraws when a lyrics fetch lands
    const now = await $.clock.now()
    const width = Math.max(1, e.props.bodyColumns)

    // An empty list means no poll has answered yet, which is not the same as
    // a poll that found nothing installed.
    const installed = players.filter(p => p.isInstalled)
    const shown: PlayerApp = picked ?? active?.app ?? installed[0]?.app ?? 'Music'
    const player = players.find(p => p.app === shown)
    const track = player?.track ?? null

    // The pane redraws on success; a control that failed says so in a toast.
    const press = (action: Action, value?: number) => async () => {
      try {
        const result = await control($, action, shown, value)
        if (!result.startsWith(`${shown} is playing`) && !result.startsWith(`${shown} is paused`)) $.ui.toast(result)
      } catch (error) {
        $.ui.toast(`${action} failed: ${String(error)}`)
      }
    }

    const cover = covers[shown]
    const hasCover = track !== null && cover !== undefined && cover.trackId === track.id
    const accent = readable(hasCover && cover.accent !== undefined ? cover.accent : NEUTRAL)
    const layout = layoutFor(width)

    const state: PaneView['state'] =
      players.length > 0 && installed.length === 0 ? 'none-installed' : player === undefined || !player.isRunning ? 'closed' : track === null ? 'stopped' : 'track'

    const position = track === null ? 0 : positionNow(track, polledAt[track.app] ?? now, now)
    let lyrics: PaneView['lyrics'] = { status: 'off' }
    if (track !== null && state === 'track' && lyricsOn) {
      const entry = lyricsCache.get(track.id)
      lyrics =
        entry === undefined
          ? { status: 'loading' }
          : entry.status === 'none'
            ? { status: 'none' }
            : { status: 'found', ...lyricWindow(entry.lines, position) }
    }
    isTicking = state === 'track' && track?.state === 'playing'
    isPaneOpen = true

    // The sleeve: the cover, with the record peeking out from behind it.
    // Image and Raster are the terminal's alone; the engine draws an Image
    // only where it detects kitty graphics, so half-block cells are the default.
    record = null
    let sleeve = null
    if (track !== null && state === 'track' && e.surface === 'terminal' && layout.art !== 0) {
      const { Box, Image, Raster } = $.ui.resolve(e)
      const size = layout.art
      const artRows = size / 2
      const cells = hasCover ? cover.cells[`${size}`] : undefined
      const art =
        hasCover && (artMode === 'image' || cells === undefined) ? (
          <Image
            key="cover"
            source={{ file: cover.file, format: 'png', generation: cover.generation }}
            columns={size}
            rows={artRows}
            alt={`${track.album} cover (try /music art blocks)`}
          />
        ) : cells !== undefined ? (
          <Raster key="cover" columns={size} rows={artRows} cells={cells} />
        ) : null
      if (art !== null) {
        record = layout.peek > 0 ? { columns: layout.peek, rows: artRows, label: accent, isPlaying: track.state === 'playing' } : null
        sleeve = (
          <Box flexDirection="row">
            {art}
            {record !== null && (
              <Raster key="record" columns={record.columns} rows={record.rows} cells={recordCells(record.columns, record.rows, theta, accent)} />
            )}
          </Box>
        )
      }
    }

    const view: PaneView = {
      width,
      tabs: installed.map(({ app }) => ({
        app,
        label: LABELS[app],
        isShown: app === shown,
        isPlaying: players.find(p => p.app === app)?.track?.state === 'playing',
      })),
      shown,
      shownLabel: LABELS[shown],
      canFavorite: shown === 'Music' && track?.favorited !== undefined,
      state,
      track,
      position,
      lyrics,
      accent,
      layout,
      sleeve,
      handlers: {
        toggleLyrics: () => void setLyricsOn($, !lyricsOn),
        pickTab: app => void update($, sourceAtom, () => app),
        open: () => void openApp($, shown),
        press,
        toggleShuffle: () => playModeBusy.shuffle || void notify($, setPlayMode($, 'shuffle', undefined, shown), 'Shuffle'),
        cycleRepeat: () => playModeBusy.repeat || void notify($, setPlayMode($, 'repeat', undefined, shown), 'Repeat'),
        toggleFavorite: () =>
          void (async () => {
            try {
              const result = await setFavorite($, !(track?.favorited ?? false))
              if (!result.startsWith('Added') && !result.startsWith('Removed')) $.ui.toast(result)
            } catch (error) {
              $.ui.toast(`Favorite failed: ${String(error)}`)
            }
          })(),
      },
    }
    return paneTree($.ui.resolve(e), view)
  })
plugins/now-playing/hooks/pane.tsx lines 39–169 · Pane
export function paneTree(ui: Pick<Elements['desktop'], 'Box' | 'Text' | 'Button'>, view: PaneView) {
  const { Box, Text, Button } = ui
  const row = (key: string, ...children: RenderChildren[]) => (
    <Box key={key} flexDirection="row" justifyContent="center" width={view.width}>
      {children}
    </Box>
  )
  const tabs =
    view.tabs.length > 1
      ? row(
          'row-tabs',
          <Box flexDirection="row" columnGap={3}>
            {view.tabs.map((t, i) => (
              <Button
                key={`tab-${t.app}`}
                label={t.isPlaying ? `${t.label} ♪` : t.label}
                hotkey={String(i + 1)}
                plain
                dimColor={!t.isShown}
                onPress={() => view.handlers.pickTab(t.app)}
              />
            ))}
          </Box>,
        )
      : null
  const label = view.shownLabel

  if (view.state === 'none-installed') {
    return (
      <Box flexDirection="column">
        {row('row-message', <Text dimColor>Install Apple Music or Spotify to use this player.</Text>)}
      </Box>
    )
  }
  if (view.state === 'closed') {
    return (
      <Box flexDirection="column" rowGap={1}>
        {tabs}
        {row('row-message', <Text dimColor>{label} is closed.</Text>)}
        {row('row-action', <Button key="open" label={`Open ${label}`} hotkey="o" plain onPress={view.handlers.open} />)}
      </Box>
    )
  }
  if (view.state === 'stopped' || view.track === null) {
    return (
      <Box flexDirection="column" rowGap={1}>
        {tabs}
        {row('row-message', <Text dimColor>{label} is stopped.</Text>)}
        {row(
          'row-action',
          <Button
            key="toggle"
            label="▶ Play"
            hotkey="k"
            plain
            onPress={view.handlers.press('play')}
          />,
        )}
      </Box>
    )
  }

  const track = view.track
  const isPlaying = track.state === 'playing'
  const isShuffle = track.shuffle === true
  const isRepeat = track.repeat === 'all' || track.repeat === 'one'
  const played = track.duration > 0 ? Math.min(view.width - 1, Math.floor((view.position / track.duration) * view.width)) : 0
  return (
    <Box flexDirection="column">
      {tabs}
      <Box height={1} />
      {view.sleeve !== null && row('row-sleeve', view.sleeve as RenderChildren)}
      <Box height={1} />
      {wrapLines(track.name, view.width).map((line, i) => row(`row-title-${i}`, <Text bold>{line}</Text>))}
      {wrapLines(track.artist, view.width).map((line, i) => row(`row-artist-${i}`, <Text>{line}</Text>))}
      {wrapLines(track.album, view.width).map((line, i) => row(`row-album-${i}`, <Text dimColor>{line}</Text>))}
      {view.lyrics.status !== 'off' && <Box height={1} />}
      {view.lyrics.status === 'found' && row('row-lyric-prev', <Text dimColor wrap="truncate-end">{view.lyrics.prev || ' '}</Text>)}
      {view.lyrics.status === 'found' && row('row-lyric-current', <Text bold color={hex(view.accent)} wrap="truncate-end">{view.lyrics.current || ' '}</Text>)}
      {view.lyrics.status === 'found' && row('row-lyric-next', <Text dimColor wrap="truncate-end">{view.lyrics.next || ' '}</Text>)}
      {(view.lyrics.status === 'none' || view.lyrics.status === 'loading') &&
        row('row-lyric-none', <Text dimColor>{view.lyrics.status === 'none' ? 'No synced lyrics' : 'Looking for lyrics…'}</Text>)}
      <Box height={1} />
      <Box key="row-bar" flexDirection="row" width={view.width}>
        <Text color={hex(view.accent)}>{'━'.repeat(played)}</Text>
        <Text color={hex(view.accent)} bold>╸</Text>
        <Text dimColor>{'─'.repeat(Math.max(0, view.width - played - 1))}</Text>
      </Box>
      <Box key="row-times" flexDirection="row" justifyContent="space-between" width={view.width}>
        <Text dimColor>{formatTime(view.position)}</Text>
        <Text dimColor>{formatTime(track.duration)}</Text>
      </Box>
      <Box height={1} />
      {row(
        'row-transport',
        <Box flexDirection="row" columnGap={4}>
          <Button key="prev" label="⏮" hotkey="b" plain onPress={view.handlers.press('previous')} />
          <Button key="toggle" label={isPlaying ? '⏸' : '▶'} hotkey="k" plain onPress={view.handlers.press('toggle')} />
          <Button key="next" label="⏭" hotkey="n" plain onPress={view.handlers.press('next')} />
          {view.canFavorite && (
            <Button key="fav" label={track.favorited === true ? '♥' : '♡'} hotkey="f" plain onPress={view.handlers.toggleFavorite} />
          )}
        </Box>,
      )}
      {row(
        'row-playmode',
        <Box flexDirection="row" columnGap={3}>
          <Box flexDirection="row" columnGap={1}>
            {isShuffle ? <Text color={hex(view.accent)}>●</Text> : <Text> </Text>}
            <Button key="shuffle" label={`⇄ Shuffle ${isShuffle ? 'on' : 'off'}`} hotkey="s" plain dimColor={!isShuffle} onPress={view.handlers.toggleShuffle} />
            {/* "on" is one column narrower than "off"; keep the row's width fixed */}
            {isShuffle && <Text> </Text>}
          </Box>
          <Box flexDirection="row" columnGap={1}>
            {isRepeat ? <Text color={hex(view.accent)}>●</Text> : <Text> </Text>}
            <Button key="repeat" label={`↻ Repeat ${track.repeat ?? 'off'}`} hotkey="r" plain dimColor={!isRepeat} onPress={view.handlers.cycleRepeat} />
          </Box>
        </Box>,
      )}
      {row(
        'row-volume',
        <Box flexDirection="row" columnGap={1}>
          <Button key="vol-down" label="−" hotkey="d" plain dimColor onPress={view.handlers.press('volume', track.volume - 10)} />
          <Text dimColor>vol {track.volume}</Text>
          <Button key="vol-up" label="+" hotkey="u" plain dimColor onPress={view.handlers.press('volume', track.volume + 10)} />
          <Button key="lyrics" label={view.lyrics.status === 'off' ? 'lyrics off' : 'lyrics on'} hotkey="l" plain dimColor onPress={view.handlers.toggleLyrics} />
        </Box>,
      )}
    </Box>
  )
}
Licence text (MIT)
MIT License

Copyright (c) 2026 Jimmy Hsiao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

How to build this: Pane (panel), Deny a tool call

What its code calls

runs programsenv varstool callsremembers

What its code shows

Read from the source at commit 73894e79ed31 on 2026-10-11. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.plugins/now-playing/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.7 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).plugins/now-playing/hooks/register.tsx:160 ps (not on Windows); plugins/now-playing/hooks/register.tsx:165 kill (not on Windows); plugins/now-playing/hooks/register.tsx:298 mkdir (not on Windows); plugins/now-playing/hooks/register.tsx:316 sips (not on Windows); plugins/now-playing/hooks/register.tsx:341 sips (not on Windows)
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.plugins/now-playing/hooks/register.tsx:81 osascript (a shell or interpreter); plugins/now-playing/hooks/register.tsx:85 curl (reaches the network); plugins/now-playing/hooks/register.tsx:175 osascript (a shell or interpreter)
Reads and sendsWhether it both reads something of yours (files, environment variables, the transcript, settings) and reaches outside (the network, an MCP server, another session, telemetry).reads environment variables and reaches the network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets ModsCode show its code; otherwise the code is linked.MIT
Settings hooksHooks declared in hooks/hooks.json or plugin.json beside the module: a command (a shell when it has no args), an HTTP request, an MCP tool or a model prompt at an event. They run outside $.no settings hooks: its function hooks alone
Servers it shipsMCP servers (a program, or a URL; a headersHelper is a shell command; a .mcpb bundle is unpacked at run time), LSP servers, monitors (a shell command for the whole session) and bin/ (on the PATH of the Bash tool).ships no MCP or LSP server, no monitor, no bin/
Skills, commands, agentsWhat its Markdown declares beyond text: allowed-tools granted for the turn, hooks added when a skill is invoked, a command run before Claude reads the skill.no skills, commands, agents or workflows
Tools and MCPWhether every tool it calls through $.tool.call and $.mcp.call is named in the code, and none is a shell (Bash through the tool runs a shell without $.process).calls no tool, MCP server or command
Asks of the modelCompletions it runs ($.model.complete, fork, classify), subagents it spawns, prompts it submits as you, and the tools, commands and agents it adds.adds command music, adds tool music
Events it hooksBy what a hook there can do: gates (refuse a tool call, a prompt, a setting, another plugin), shapes (what the model reads: the system prompt, tool descriptions, each request), reads (your input, the events of the settings hooks, every event with *), and the rest.gates: command.run (music), tool.call (mcp__now-playing__music) · also: session.start, ui.close, ui.render (Pane) · timers: clock.after, clock.every
Reads, by nameThe environment variables and files it names, and whether it reads the transcript, settings.json, the prompt box or the mouse selection.env: HOME
Writes, by nameThe files and environment variables it names, and whether it changes settings, the prompt box, the clipboard, the conversation (a row the model reads) or another session.writes no files, environment variables, settings or conversation rows

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and ModsCode does not vouch for what this code does. Read its code (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

From its marketplace

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add Fatmylin/now-playing
/plugin install now-playing@now-playing
/reload-plugins

This installs the marketplace's latest commit, which may not be the one read here (73894e79ed31). Compare them before you install. /reload-plugins loads it into a session that is already open.

Try the commit ModsCode read

No marketplace needed. In a terminal, clone the repository, check out the commit read, validate the mod, and load it for one session:

git clone https://github.com/Fatmylin/now-playing
git -C now-playing checkout 73894e79ed3182ef0a73d2f389e62373b76dfe21
claude plugin validate now-playing/plugins/now-playing
claude --plugin-dir now-playing/plugins/now-playing

The validate line lists the events the mod hooks and what it asks Claude Code to do, without running it. The last line loads the mod for this session only and writes nothing to your settings. If the author has rewritten history, the commit may no longer exist.

Ask Claude about it

With the ModsCode connector added, Claude can read this mod's code and what it reaches, and build on them. Ask it like this:

Read the ModsCode mod "fatmylin-now-playing" with its code and make me one like it

Search them from Claude: the MCP connector

Similar mods

Badge for your README

If this is your mod, paste this into your README. It links to this page.

README.md
[![ModsCode](https://modscode.com/badge/fatmylin-now-playing.svg)](https://modscode.com/claude-mods/mods/fatmylin-now-playing/)