From d415f691262d03767b40674b1a48cac0ec1e124d Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Tue, 19 Sep 2023 22:41:33 +0200 Subject: [PATCH] pinwheel: Escape `spotify` output To get around trouble parsing e.g. `&` --- hosts/pinwheel/modules/waybar/default.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hosts/pinwheel/modules/waybar/default.nix b/hosts/pinwheel/modules/waybar/default.nix index e6b0290..9885044 100644 --- a/hosts/pinwheel/modules/waybar/default.nix +++ b/hosts/pinwheel/modules/waybar/default.nix @@ -6,15 +6,14 @@ let if [ "$STATUS" = "No players found" ]; then echo " " else - TITLE=$(${pkgs.playerctl}/bin/playerctl -p spotify metadata xesam:title) - ARTIST=$(${pkgs.playerctl}/bin/playerctl -p spotify metadata xesam:artist) - + FORMAT="{{markup_escape(xesam:title)}} - {{markup_escape(xesam:artist)}}" + OUTPUT=$(${pkgs.playerctl}/bin/playerctl -p spotify metadata --format "$FORMAT") case "$STATUS" in "Playing") - echo " $TITLE - $ARTIST" + echo " $OUTPUT" ;; "Paused") - echo " $TITLE - $ARTIST" + echo " $OUTPUT" ;; *) echo " "