From 581de8ddc95b13c0dc04a96fd6edb84836c5ccb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferit=20Yi=C4=9Fit=20BALABAN?= Date: Fri, 22 Apr 2022 01:45:22 +0300 Subject: [PATCH] Added bash version with fewer lines and potentially better performance --- nowplaying.sh | 9 +++++++++ source_polybar.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100755 nowplaying.sh diff --git a/nowplaying.sh b/nowplaying.sh new file mode 100755 index 0000000..aade69e --- /dev/null +++ b/nowplaying.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +if [ $(playerctl status) = 'Playing' ]; then + a=$( playerctl metadata artist ) + t=$( playerctl metadata title ) + echo "$a - $t" +fi + +exit 0 diff --git a/source_polybar.py b/source_polybar.py index 7d1e47d..bc0d412 100755 --- a/source_polybar.py +++ b/source_polybar.py @@ -52,7 +52,7 @@ def main(): [module/music] type = custom/script - exec = /home/ferit/scripts/nowplaying.py + exec = /home/ferit/scripts/nowplaying.sh tail = true interval = 2