From 13b5934e657505aa3800f6b81bbe756a06d3fcf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stanislav=20Ochotnick=C3=BD?= Date: Thu, 16 Sep 2021 19:22:00 +0200 Subject: [PATCH] Add MPRIS example in script module documentation --- doc/yambar-modules-script.5.scd | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/yambar-modules-script.5.scd b/doc/yambar-modules-script.5.scd index 26b210f..7ba46d8 100644 --- a/doc/yambar-modules-script.5.scd +++ b/doc/yambar-modules-script.5.scd @@ -113,6 +113,37 @@ bar: content: {string: {text: "{test}"}} ``` +Another example use case of this module could be to display currently playing +song or other media from players that support MPRIS (Media Player Remote +Interfacing Specification): + +``` +bar: + center: + - script: + path: /usr/bin/playerctl + args: + - "--follow" + - "metadata" + - "-f" + - | + status|string|{{status}} + artist|string|{{artist}} + title|string|{{title}} + content: + map: + tag: status + values: + Paused: {empty: {}} + Playing: + content: {string: {text: "{artist} - {title}"}} +``` + +The above snippet runs a _playerctl_ utility in _--follow_ mode, reacting to +media updates on DBUS and outputting status, artist and title of media being +played in a format that is recognized by yambar. See _playerctl_ documentation +for more available metadata fields and control over which players get used. + # SEE ALSO *yambar-modules*(5), *yambar-particles*(5), *yambar-tags*(5), *yambar-decorations*(5)