Skip to content

emacsmirror/doom-modeline-now-playing

 
 

Repository files navigation

doom-modeline-now-playing

https://melpa.org/packages/doom-modeline-now-playing-badge.svg

Cross-platform doom-modeline segment to display information about the currently playing song. Supports both Linux (via playerctl) and macOS (via AppleScript & media-control).

You can click the status icon to toggle play/pause, or use the interactive function doom-modeline-now-playing-toggle-status.

.github/demo.png

Features

  • Cross-platform: Works on Linux (playerctl) and macOS (AppleScript)
  • Customizable: Control update interval, text length, and playerctl format
  • Interactive: Click to play/pause or use keyboard commands
  • Multiple players: Supports Spotify, Music.app, and any MPRIS-compatible player
  • Modular: Clean provider-based architecture for easy extension

Install

Dependencies

Linux

  • playerctl - For MPRIS-compatible media players
    # Arch Linux
    sudo pacman -S playerctl
    
    # Ubuntu/Debian
    sudo apt install playerctl
    
    # Fedora
    sudo dnf install playerctl
        

macOS

  • Attempts to default to media-control
  • Falls back to built-in AppleScript support (no additional dependencies)
  • Supports Spotify, Music.app, and other AppleScript-compatible players or anything media-control supports

Manual

Add the package to your load path after doom-modeline:

(add-to-list 'load-path "/path/to/doom-modeline-now-playing")
(require 'doom-modeline-now-playing)

MELPA

Install doom-modeline-now-playing with your package manager:

;; use-package
(use-package doom-modeline-now-playing
  :after doom-modeline
  :config
  (doom-modeline-now-playing-timer))

;; straight.el
(straight-use-package 'doom-modeline-now-playing)

Usage

Basic Setup

Add this to your config after loading doom-modeline:

(doom-modeline-now-playing-timer)

Add to Modeline

Include now-playing in your modeline configuration:

(doom-modeline-def-modeline 'main
    '(bar workspace-name window-number modals matches buffer-info remote-host buffer-position parrot selection-info)
    '(now-playing objed-state misc-info persp-name battery grip irc mu4e gnus github debug repl lsp minor-modes input-method major-mode process vcs checker))

Configuration

Global Settings

;; Enable/disable the segment (default: t)
(setq doom-modeline-now-playing t)

;; Update interval in seconds (default: 5)
(setq doom-modeline-now-playing-interval 5)

;; Maximum text length before truncation (default: 40)
(setq doom-modeline-now-playing-max-length 40)

Platform-specific Settings

Linux (playerctl)

;; Customize output format using playerctl template syntax
(setq doom-modeline-now-playing-playerctl-format "{{artist}} - {{title}}")

;; Ignore specific players (e.g., browser players)
(setq doom-modeline-now-playing-playerctl-ignored-players '("firefox" "chromium"))

Available playerctl format options:

  • playerName - Player application name
  • artist - Track artist
  • title - Track title
  • album - Album name
  • status - Playback status (playing/paused/stopped)
  • position - Current position in microseconds
  • volume - Volume level

Functions: lc(), uc(), duration(), markup_escape(), default(), emoji()

macOS (AppleScript)

;; Specify which applications to check (default: Spotify and Music)
(setq doom-modeline-now-playing-macos-players '("Spotify" "Music" "VLC"))

Interactive Commands

;; Toggle play/pause for current player
M-x doom-modeline-now-playing-toggle-status

;; Start/stop the update timer
M-x doom-modeline-now-playing-timer

Architecture

The package uses a modular provider-based architecture:

  • doom-modeline-now-playing.el - Core functionality and UI
  • doom-modeline-now-playing-playerctl.el - Linux/playerctl provider
  • doom-modeline-now-playing-osascript.el - macOS/AppleScript provider
  • doom-modeline-now-playing-media-control.el - media-control provider

The appropriate provider is automatically loaded based on your system type.

Troubleshooting

Linux: “No players found”

  • Ensure a supported media player is running
  • Check doom-modeline-now-playing-playerctl-ignored-players settings
  • Test playerctl directly: playerctl status

macOS: No AppleScript support

  • Verify the media player supports AppleScript
  • Add unsupported players to doom-modeline-now-playing-macos-players

Contributing

Contributions welcome! To add support for new platforms:

  1. Create a new provider file following the existing pattern
  2. Inherit from doom-modeline-now-playing-provider
  3. Implement doom-modeline-now-playing-provider-get-info and doom-modeline-now-playing-provider-play-pause
  4. Add loading logic to the main file

About

Segment for Doom Modeline to show media player information

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published

Languages

  • Emacs Lisp 100.0%