waybar: only show playerctl status when playing
This commit is contained in:
		
							parent
							
								
									884a8df73c
								
							
						
					
					
						commit
						a846f50b42
					
				
					 1 changed files with 16 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -94,13 +94,22 @@ in
 | 
			
		|||
            on-scroll-up = "${mpc} vol +10";
 | 
			
		||||
            on-scroll-down = "${mpc} vol -10";
 | 
			
		||||
          };
 | 
			
		||||
        "custom/playerctl" = {
 | 
			
		||||
          format = "{}";
 | 
			
		||||
          exec = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd metadata title";
 | 
			
		||||
          on-click = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd play-pause";
 | 
			
		||||
          interval = 1;
 | 
			
		||||
          tooltip = false;
 | 
			
		||||
        };
 | 
			
		||||
        "custom/playerctl" =
 | 
			
		||||
          let
 | 
			
		||||
            playerctl = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd";
 | 
			
		||||
            statusScript = pkgs.writeShellScript "waybar-playerctl-status" ''
 | 
			
		||||
              test "$(env LC_ALL=C ${playerctl} status title)" = "Playing" \
 | 
			
		||||
              && ${playerctl} metadata title \
 | 
			
		||||
              || echo ""
 | 
			
		||||
            '';
 | 
			
		||||
          in
 | 
			
		||||
          {
 | 
			
		||||
            format = "{}";
 | 
			
		||||
            exec = "${statusScript}";
 | 
			
		||||
            on-click = "${playerctl} play-pause";
 | 
			
		||||
            interval = 1;
 | 
			
		||||
            tooltip = false;
 | 
			
		||||
          };
 | 
			
		||||
        "sway/language" = { format = "{short} {variant}"; };
 | 
			
		||||
        "custom/caffeine" = {
 | 
			
		||||
          format = "{}";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue