A cross-platform tmux plugin that displays currently playing media. On macOS, it uses the system-wide Now Playing widget. On Linux, it uses MPRIS to work with any compatible media player.
- π΅ Cross-platform support (macOS and Linux)
- π Works with web-based players (YouTube, SoundCloud, etc.)
- π§ Supports Spotify, Apple Music, VLC, and all compatible media apps
- β‘ Native integration:
- macOS: Uses MediaRemote framework
- Linux: Uses MPRIS D-Bus interface via playerctl
- π― Minimal dependencies
- π§ Customizable icons and formatting
- π Optional scrolling for long artist/title text
- tmux 2.9 or later
- macOS 10.15 or later
- Swift runtime (included with macOS)
- playerctl (for MPRIS support)
- D-Bus (usually pre-installed)
If you're upgrading from the old tmux-nowplaying-macos
plugin:
-
Update your
~/.tmux.conf
:# Old: set -g @plugin 'barlevalon/tmux-nowplaying-macos' # New: set -g @plugin 'barlevalon/tmux-nowplaying'
-
Remove the old plugin and install the new one:
rm -rf ~/.tmux/plugins/tmux-nowplaying-macos
-
Press
prefix + I
to install the new plugin
The plugin now supports both macOS and Linux!
Using TPM (recommended)
Add plugin to your ~/.tmux.conf
:
set -g @plugin 'barlevalon/tmux-nowplaying'
Press prefix + I
to install the plugin.
Clone the repository:
git clone https://github.com/barlevalon/tmux-nowplaying ~/.tmux/plugins/tmux-nowplaying
Add this to your ~/.tmux.conf
:
run-shell ~/.tmux/plugins/tmux-nowplaying/nowplaying.tmux
Reload tmux configuration:
tmux source ~/.tmux.conf
Add #{nowplaying}
to your status-left
or status-right
in ~/.tmux.conf
:
set -g status-right '#{nowplaying} | %H:%M'
The plugin will display the currently playing track in the format: βͺ Artist - Title
Note: After installing the plugin, you may need to reload your tmux configuration (prefix + r
or tmux source ~/.tmux.conf
) for the interpolation to take effect.
# Playing icon (default: "βͺ ")
set -g @nowplaying_playing_icon "π΅ "
# Paused icon (default: "")
set -g @nowplaying_paused_icon "βΈ "
# Stopped icon (default: "")
set -g @nowplaying_stopped_icon "βΉ "
When the artist and title text is too long, it can automatically scroll:
# Enable/disable scrolling text (default: "no")
set -g @nowplaying_scrolling_enabled "yes"
# Maximum characters before scrolling (default: 50, minimum: 1)
set -g @nowplaying_scrollable_threshold 50
# Scroll speed multiplier (default: 1, range: 1-10)
# Higher values = faster scrolling
set -g @nowplaying_scroll_speed 1
# Padding between text repetitions (default: " ")
set -g @nowplaying_scroll_padding " "
The plugin automatically updates when tmux refreshes the status bar. You can control the refresh rate:
# Refresh every 2 seconds (default: 15)
set -g status-interval 2
# Enable automatic interval adjustment for smooth scrolling (default: "no")
# Only works when scrolling is enabled
set -g @nowplaying_auto_interval "yes"
# Interval when playing and scrolling (default: 1)
set -g @nowplaying_playing_interval 1
By default, the plugin automatically manages the refresh rate:
- 1 second when text is scrolling for smooth animation
- Your original status-interval when music is stopped or text fits without scrolling
- The plugin remembers your original
status-interval
and restores it when not scrolling - You can disable this automatic management by setting
@nowplaying_auto_interval
to "no"
The plugin automatically detects your operating system and uses the appropriate method:
Uses the private MediaRemote framework to access the same "Now Playing" information that appears in Control Center. Works with any media source on your system.
Uses the MPRIS (Media Player Remote Interfacing Specification) D-Bus interface via playerctl. This is the standard protocol that most Linux media players support, including:
- Spotify (desktop and TUI clients like spotify-player)
- VLC
- Firefox/Chrome (for web-based media)
- Rhythmbox, Clementine, and most other players
The plugin consists of:
- Platform-specific scripts (Swift for macOS, bash for Linux)
- A main bash script that detects the OS and calls the appropriate handler
- TPM-compatible plugin structure
Feature | tmux-nowplaying-macos | tmux-spotify | nowplaying-cli |
---|---|---|---|
Works with all media apps | β | β | β |
No external dependencies | β | β | β |
TPM compatible | β | β | β |
Maintained | β | β | β |
Cross-platform | β | β | β |
Install playerctl for MPRIS support:
# Arch Linux
sudo pacman -S playerctl
# Ubuntu/Debian
sudo apt install playerctl
# Fedora
sudo dnf install playerctl
- Ensure media is actually playing in a supported app
- Check that the script has execute permissions:
chmod +x ~/.tmux/plugins/tmux-nowplaying/scripts/*
- Test the script directly:
~/.tmux/plugins/tmux-nowplaying/scripts/nowplaying.sh
- Check if playerctl is installed:
which playerctl
- List available players:
playerctl -l
- Test playerctl directly:
playerctl metadata
Make sure Swift is available:
swift --version
The first run may be slower as Swift compiles the script. Subsequent runs will be faster.
tmux options remain set even after removing them from your config. To fully disable scrolling after removing the configuration:
# Explicitly disable scrolling
tmux set-option -g @nowplaying_scrolling_enabled "no"
# Or unset all plugin options to restore defaults
tmux set-option -gu @nowplaying_scrolling_enabled
tmux set-option -gu @nowplaying_scrollable_threshold
tmux set-option -gu @nowplaying_scroll_speed
Pull requests are welcome! Please feel free to submit issues or PRs.
MIT - see LICENSE file for details.
- Uses macOS MediaRemote framework
- Inspired by tmux-spotify and nowplaying-cli
- Created by @barlevalon