Skip to content

[Feature] Discord Rich Presence (RPC) & Status Line IPC (tmux / Waybar / SketchyBar) #8

Description

@arkalon76

📌 Feature Summary

Implement Discord Rich Presence (RPC) to show live radio status on Discord, along with a lightweight CLI query/IPC mode (halpradio current, halpradio toggle, halpradio status --json) for status bars (tmux, Waybar, Polybar, SketchyBar).


🎯 Motivation & User Story

"As a developer and ricing enthusiast, I want to show my currently playing radio station and Animal DJ avatar on Discord, and embed my current playing track in my tmux statusline or Waybar without keeping the full TUI window open."

Customizing desktop status bars and sharing musical vibes on Discord is a core ritual for terminal and Linux/macOS ricing communities. Providing simple IPC commands makes halpradio universally scriptable.


💻 Proposed Functional Specification

1. Discord Rich Presence (RPC)

  • Updates Discord profile activity in real time:
    • State: Station Name (e.g. SomaFM Groove Salad)
    • Details: Artist - Title (or Streaming Live...)
    • Large Image: halpradio_logo with hover text "halpradio - Terminal Internet Radio"
    • Small Image: Active Animal DJ character icon (dj_cat, dj_dog, dj_bear, dj_frog, dj_bunny)
    • Timestamps: Elapsed listening duration.
  • Toggle via CLI flag -discord or config.yaml (discord_rpc: true/false).

2. CLI IPC & Status Line Query Mode

  • Non-interactive CLI subcommands that communicate with a running halpradio instance:
    • halpradio current: Outputs plain text: SomaFM Groove Salad: Tycho - A Walk
    • halpradio current --json: Returns JSON payload:
      {
        "status": "playing",
        "station_id": "somafm_groovesalad",
        "station_name": "SomaFM Groove Salad",
        "artist": "Tycho",
        "title": "A Walk",
        "bitrate": 128,
        "backend": "mpv",
        "volume": 80,
        "visualizer": "dj-cat"
      }
    • Remote controls:
      • halpradio remote toggle
      • halpradio remote next
      • halpradio remote prev
      • halpradio remote stop

🏗️ Technical & Architectural Guidelines

  1. Discord RPC Implementation:
    • Use a lightweight Discord IPC package (e.g. hugolgst/rich-go or direct named pipe / unix domain socket connection /tmp/discord-ipc-0).
    • Must run non-blocking in background; fail silently if Discord is not running.
  2. Local IPC Server:
    • When halpradio starts, create a local Unix domain socket (or Windows named pipe) at ~/.config/halpradio/halpradio.sock.
    • CLI subcommands connect to this socket to query status or send control commands.
    • Remote commands trigger corresponding tea.Msg events on the main Bubble Tea program loop.

✅ Acceptance Criteria

  • Discord displays halpradio status with station, track info, and active DJ avatar when enabled.
  • halpradio current and halpradio current --json output accurate live stream state for status bars.
  • halpradio remote [toggle|next|prev|stop] correctly manipulates the running instance.
  • Graceful fallback when Discord is closed or socket is unavailable (zero panics).
  • Unit tests for JSON output schema and IPC message serialization.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions