Remote commands
rmpc provides powerful remote command capabilities that allow you to control a running rmpc instance from the command line. this is especially useful for scripting and window manager integration.
overview
Section titled “overview”the remote command system allows you to:
- emulate key presses (
keybind
) - trigger any keybind as if pressed in the interface - switch tabs directly (
switch-tab
) - change to a specific tab without relying on keybinds - send status messages - display custom messages in the status bar
- update configuration - modify theme and other settings remotely
- target specific instances - send commands to a particular rmpc process by pid
all remote commands follow this pattern:
rmpc remote [--pid <pid>] <command> <args>
if --pid
is not specified, the command will be sent to all running rmpc instances.
keybind command
Section titled “keybind command”the keybind
command emulates pressing a key combination in the running rmpc interface.
syntax
Section titled “syntax”rmpc remote keybind <key>
examples
Section titled “examples”# press 'p' (typically play/pause)rmpc remote keybind p
common key examples
Section titled “common key examples”# basic navigationrmpc remote keybind j # move downrmpc remote keybind k # move uprmpc remote keybind h # move leftrmpc remote keybind l # move right
# playback controlrmpc remote keybind p # toggle play/pausermpc remote keybind s # stop playbackrmpc remote keybind ">" # next trackrmpc remote keybind "<" # previous track
# tab switching (numbers)rmpc remote keybind 1 # switch to queue tabrmpc remote keybind 2 # switch to directories tabrmpc remote keybind 3 # switch to artists tabrmpc remote keybind 4 # switch to album artists tabrmpc remote keybind 5 # switch to albums tabrmpc remote keybind 6 # switch to playlists tabrmpc remote keybind 7 # switch to search tab
# volume controlrmpc remote keybind "." # volume uprmpc remote keybind "," # volume down
# seek controlrmpc remote keybind f # seek forwardrmpc remote keybind b # seek backward
# modesrmpc remote keybind z # toggle repeatrmpc remote keybind x # toggle randomrmpc remote keybind c # toggle consumermpc remote keybind v # toggle single
# help and informpc remote keybind "~" # Show helprmpc remote keybind I # Show current song informpc remote keybind O # Show outputsrmpc remote keybind P # Show decoders
Key Format Notes
Section titled “Key Format Notes”For special keys, use the angle bracket format to ensure proper recognition:
# Correct formats for special keysrmpc remote keybind "<CR>" # Enter keyrmpc remote keybind "<Space>" # Space keyrmpc remote keybind "<Esc>" # Escape keyrmpc remote keybind "<Tab>" # Tab keyrmpc remote keybind "<BS>" # Backspace key
# Modifiers use angle brackets toormpc remote keybind "<C-p>" # Ctrl+prmpc remote keybind "<S-CR>" # Shift+Enterrmpc remote keybind "<A-h>" # Alt+h
switch-tab command
Section titled “switch-tab command”The switch-tab
command provides a direct way to switch between tabs without relying on keybind configuration.
Syntax
Section titled “Syntax”rmpc remote switch-tab <tab-name>
Examples
Section titled “Examples”# Switch to specific tabsrmpc remote switch-tab "Queue"rmpc remote switch-tab "Directories"rmpc remote switch-tab "Artists"rmpc remote switch-tab "Albums"rmpc remote switch-tab "Playlists"rmpc remote switch-tab "Search"rmpc remote switch-tab "Lyrics"
# Works with custom tab names toormpc remote switch-tab "My Custom Tab"
# Tab names are case-insensitivermpc remote switch-tab "queue" # same as "Queue"rmpc remote switch-tab "ARTISTS" # same as "Artists"rmpc remote switch-tab "playlists" # same as "Playlists"
Tab Name Validation
Section titled “Tab Name Validation”The switch-tab
command validates that the specified tab exists in your configuration using case-insensitive matching. This means you can use any capitalization you prefer - queue
, Queue
, QUEUE
, etc. will all match the same tab.
If you try to switch to a non-existent tab, the command will fail with an error message listing all available tabs.
You can check your available tabs by looking at your configuration file or using rmpc config
to see the configured tabs.
Other Remote Commands
Section titled “Other Remote Commands”Besides keybind
, rmpc supports several other remote commands:
Status Messages
Section titled “Status Messages”Display custom messages in the rmpc status bar:
# Show an info message for 5 seconds (default)rmpc remote status "Hello from script!"
# Show an error message for 10 secondsrmpc remote status --level error --timeout 10000 "Something went wrong"
# Show a warning messagermpc remote status --level warn "Check your config"
Lyrics Index
Section titled “Lyrics Index”Notify rmpc about new lyrics files:
# Tell rmpc to index a new .lrc filermpc remote indexlrc --path /path/to/song.lrc
Set Commands
Section titled “Set Commands”Update configuration in a running rmpc instance:
# Update theme from filermpc remote set theme /path/to/new-theme.ron
# Update theme from stdincat new-theme.ron | rmpc remote set theme -
Targeting Specific Instances
Section titled “Targeting Specific Instances”If you have multiple rmpc instances running, you can target a specific one using the --pid
option:
# Find rmpc processesps aux | grep rmpc
# Send command to specific instancermpc remote --pid 12345 keybind prmpc remote --pid 12345 switch-tab "Queue"rmpc remote --pid 12345 status "Hello from specific instance"
Error Handling
Section titled “Error Handling”Remote commands will fail silently if:
- No rmpc instance is running
- The specified PID doesn’t exist
- Invalid key format is provided
- Tab name doesn’t exist in your configuration (for switch-tab commands)
Note: Command execution errors (like invalid tab names) are logged in the running rmpc instance at the warn level, not displayed to the CLI caller. Check the rmpc logs for detailed error messages if commands aren’t working as expected.
To see these errors, you can:
- Run rmpc with debug logging:
RUST_LOG=debug rmpc
- Check rmpc’s log output in your terminal
- Look for “Socket command execution failed” messages
Tips and Best Practices
Section titled “Tips and Best Practices”- Use quotes for special characters: Always quote keys with special characters like
">"
or"<"
or"<Tab>"
- Check keybind configuration: The remote keybind command uses your configured keybinds from your config file
- Test interactively first: Try commands manually before adding them to scripts
See Also
Section titled “See Also”- Keybind Configuration - Configure what keys do what
- Tab Configuration - Set up custom tab names
- CLI Reference - Full command reference