waybar: only show playerctl status when playing

This commit is contained in:
Leonardo Eugênio 2023-02-08 12:41:46 -03:00
parent 884a8df73c
commit a846f50b42

View file

@ -94,13 +94,22 @@ in
on-scroll-up = "${mpc} vol +10"; on-scroll-up = "${mpc} vol +10";
on-scroll-down = "${mpc} vol -10"; on-scroll-down = "${mpc} vol -10";
}; };
"custom/playerctl" = { "custom/playerctl" =
format = "{}"; let
exec = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd metadata title"; playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd";
on-click = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd play-pause"; statusScript = pkgs.writeShellScript "waybar-playerctl-status" ''
interval = 1; test "$(env LC_ALL=C ${playerctl} status title)" = "Playing" \
tooltip = false; && ${playerctl} metadata title \
}; || echo ""
'';
in
{
format = "{}";
exec = "${statusScript}";
on-click = "${playerctl} play-pause";
interval = 1;
tooltip = false;
};
"sway/language" = { format = "{short} {variant}"; }; "sway/language" = { format = "{short} {variant}"; };
"custom/caffeine" = { "custom/caffeine" = {
format = "{}"; format = "{}";