Skip to content

Command Line (nokkvi CLI)

nokkvi <verb> sends a single command to the running Nokkvi instance over a Unix socket and exits. Use it from shell scripts, window manager keybinds, or any external tool — there’s no GUI startup cost because the CLI path returns before iced initializes.

The CLI is an alternative to MPRIS. MPRIS covers the standard transport surface and works with any MPRIS controller; the CLI adds verbs that MPRIS doesn’t expose (switch-view, love, rate, clear-queue, consume).

VerbArgAction
playStart playback
pausePause playback
play-pauseToggle play / pause
stopStop and reset the playhead
nextSkip to the next track
previousReturn to the previous track
seek<seconds>Seek to absolute position (float, in seconds)
volume<value>Set volume — see Volume syntax
VerbArgAction
shuffleToggle random mode
repeatCycle repeat: off → one → queue
consumeToggle consume mode
clear-queueEmpty the queue and stop playback
add-to-queueAdd the focused list item to the queue — the in-app Shift+A
remove-from-queueRemove the centered queue song — Ctrl+D; errors not_in_queue_view outside the queue view
VerbArgAction
switch-view<view>Switch the top pane — see View names
VerbArgAction
nav-upMove the focused list selection up — Backspace
nav-downMove the focused list selection down — Tab
enterActivate the centered item — play / expand / edit

nav-up, nav-down, and enter are fire-and-forget; the move is async, so query selection afterward to read where focus landed.

These are pure reads — they print JSON and change nothing.

VerbArgAction
statusPrint playback state, track, album, position, duration, volume, and the three modes as JSON
selectionPrint the focused view’s centered item as JSON: view, kind, name, artist, rating, starred; kind is null when nothing is selectable

These act on whatever’s currently playing and exit 1 with a no_playing_track error if nothing is loaded.

VerbArgAction
loveToggle Navidrome star on the playing track
rate<delta-or-abs>Adjust the playing track rating — see Rating syntax
VerbArgAction
pingProbe the running instance. Prints pong and exits 0.
-h, --helpPrint usage and the full verb catalog, then exit 0.
-V, --versionPrint nokkvi <version>, then exit 0.

The <value> arg accepts two shapes:

  • Delta+N or -N, added to the current volume and clamped silently to 0.0..=1.0. Repeated volume +0.05 at the ceiling is a no-op.
  • AbsoluteN in 0.0..=1.0. Out-of-range values error rather than clamp.
Terminal window
nokkvi volume +0.05 # bump 5%
nokkvi volume -0.1 # drop 10%
nokkvi volume 0.5 # set to 50%

The <delta-or-abs> arg accepts two shapes:

  • Delta+N or -N, added to the current rating and clamped to 0..=5.
  • Absolute0 through 5. Out-of-range values error.
Terminal window
nokkvi rate +1 # bump by one star
nokkvi rate -1 # drop by one star
nokkvi rate 5 # set to five stars
nokkvi rate 0 # clear the rating

To confirm each change with a desktop notification — useful when you’ve bound these to a window-manager keybind — enable rating_change_notification_enabled.

switch-view accepts one of: albums, queue, songs, artists, genres, playlists, radios, settings. Anything else errors with the full list in the message.

Terminal window
nokkvi switch-view albums
nokkvi switch-view queue

Each running Nokkvi daemon binds a per-PID socket so multiple instances can coexist:

EnvironmentSocket path
$XDG_RUNTIME_DIR set$XDG_RUNTIME_DIR/nokkvi-{pid}.sock
Unset (fallback)/tmp/nokkvi-{uid}-{pid}.sock

The {uid} in the fallback path comes from the $UID environment variable, not the kernel uid. When $UID is unset it falls back to the literal default (e.g. /tmp/nokkvi-default-{pid}.sock).

The CLI auto-discovers the live socket — you don’t pass a path. If no instance is running, the command exits 1 with a message listing the directory it searched.

CodeMeaning
0Server accepted the verb. Any payload is printed to stdout (e.g. ping prints pong).
1No live instance found, or the server returned an error (e.g. invalid_args, no_playing_track, unavailable, not_in_queue_view). Error message goes to stderr.

Hyprland’s Lua config is the current binding API — hl.bind(keys, hl.dsp.exec_cmd(cmd), opts?) matches the shape from the upstream example/hyprland.lua. The Lua block below is the author’s actual ~/.config/hypr/keybinds.lua for nokkvi; the legacy .conf tab is for stable distros still on the older Hyprland.

-- ~/.config/hypr/keybinds.lua
local mod_alt = "SUPER + ALT"
-- Transport
hl.bind(mod_alt .. " + space", hl.dsp.exec_cmd("nokkvi play-pause"))
hl.bind(mod_alt .. " + right", hl.dsp.exec_cmd("nokkvi next"))
hl.bind(mod_alt .. " + left", hl.dsp.exec_cmd("nokkvi previous"))
-- Volume — { repeating = true } repeats while held
hl.bind(mod_alt .. " + up", hl.dsp.exec_cmd("nokkvi volume +0.01"), { repeating = true })
hl.bind(mod_alt .. " + down", hl.dsp.exec_cmd("nokkvi volume -0.01"), { repeating = true })
-- Rating + love on the currently playing track
hl.bind(mod_alt .. " + L", hl.dsp.exec_cmd("nokkvi love"))
hl.bind(mod_alt .. " + equal", hl.dsp.exec_cmd("nokkvi rate +1"))
hl.bind(mod_alt .. " + minus", hl.dsp.exec_cmd("nokkvi rate -1"))

Add { locked = true } (Lua) or use bindl/bindle (.conf) on any bind you want to keep working while the session is locked — the upstream example sets it on XF86Audio* keys.

The CLI is a plain executable — use whatever your compositor’s exec-keybind syntax is (sway’s bindsym, i3’s bindsym, dwm’s config.h, etc.) and call nokkvi <verb> from it.