playerctl: update playerctl config
This commit is contained in:
		
							parent
							
								
									bd31b35e6b
								
							
						
					
					
						commit
						775181e570
					
				
					 4 changed files with 34 additions and 18 deletions
				
			
		| 
						 | 
					@ -34,6 +34,7 @@ create_scripts
 | 
				
			||||||
    showkeys =
 | 
					    showkeys =
 | 
				
			||||||
      [ ]; # This will not work unless programs.wshowkeys is enabled systemwide
 | 
					      [ ]; # This will not work unless programs.wshowkeys is enabled systemwide
 | 
				
			||||||
    terminal = [ alacritty ];
 | 
					    terminal = [ alacritty ];
 | 
				
			||||||
 | 
					    playerctl-status = [ playerctl ];
 | 
				
			||||||
    wpass = [ final.wdmenu fd pass sd wl-clipboard wtype ];
 | 
					    wpass = [ final.wdmenu fd pass sd wl-clipboard wtype ];
 | 
				
			||||||
    screenshotsh =
 | 
					    screenshotsh =
 | 
				
			||||||
      [ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ];
 | 
					      [ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								scripts/playerctl-status
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								scripts/playerctl-status
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,14 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PLAYERCTL="playerctl --ignore-player=mpd"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STATUS="$(env LC_ALL=C $PLAYERCTL status title)"
 | 
				
			||||||
 | 
					TITLE="$($PLAYERCTL metadata title)"
 | 
				
			||||||
 | 
					ARTIST="$($PLAYERCTL metadata artist)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					test "$STATUS" = "Playing" \
 | 
				
			||||||
 | 
					&& printf " %s" "$TITLE" \
 | 
				
			||||||
 | 
					&& test -n "$ARTIST" \
 | 
				
			||||||
 | 
					&& printf " - %s" "$ARTIST"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo ""
 | 
				
			||||||
| 
						 | 
					@ -136,6 +136,7 @@ in
 | 
				
			||||||
              code_binds =
 | 
					              code_binds =
 | 
				
			||||||
                lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v);
 | 
					                lib.mapAttrs' (k: v: lib.nameValuePair "--to-code ${k}" v);
 | 
				
			||||||
              return_mode = lib.mapAttrs (k: v: "${v}; mode default");
 | 
					              return_mode = lib.mapAttrs (k: v: "${v}; mode default");
 | 
				
			||||||
 | 
					              playerctl = "exec ${pkgs.playerctl}/bin/playerctl";
 | 
				
			||||||
            in
 | 
					            in
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
              audio = code_binds
 | 
					              audio = code_binds
 | 
				
			||||||
| 
						 | 
					@ -166,11 +167,20 @@ in
 | 
				
			||||||
                "Ctrl+c" = "exec musmenu pclear";
 | 
					                "Ctrl+c" = "exec musmenu pclear";
 | 
				
			||||||
              };
 | 
					              };
 | 
				
			||||||
              playerctl = code_binds
 | 
					              playerctl = code_binds
 | 
				
			||||||
 | 
					                ((locked_binds
 | 
				
			||||||
 | 
					                  {
 | 
				
			||||||
 | 
					                    ${key.left} = "${playerctl} previous";
 | 
				
			||||||
 | 
					                    ${key.right} = "${playerctl} next";
 | 
				
			||||||
 | 
					                    ${key.up} = "${playerctl} volume 10+";
 | 
				
			||||||
 | 
					                    ${key.down} = "${playerctl} volume 10-";
 | 
				
			||||||
 | 
					                    ${key.tabR} = "${playerctl} volume 10+";
 | 
				
			||||||
 | 
					                    ${key.tabL} = "${playerctl} volume 10-";
 | 
				
			||||||
 | 
					                  }) //
 | 
				
			||||||
                (return_mode {
 | 
					                (return_mode {
 | 
				
			||||||
                  "space" = "exec ${pkgs.playerctl}/bin/playerctl toggle";
 | 
					                  "space" = "${playerctl} play-pause";
 | 
				
			||||||
                  "escape" = "";
 | 
					                  "escape" = "";
 | 
				
			||||||
                  "q" = "";
 | 
					                  "q" = "";
 | 
				
			||||||
                });
 | 
					                }));
 | 
				
			||||||
              passthrough = {
 | 
					              passthrough = {
 | 
				
			||||||
                "${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
 | 
					                "${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
 | 
				
			||||||
              };
 | 
					              };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -94,19 +94,10 @@ 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" = {
 | 
				
			||||||
          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 = "{}";
 | 
					          format = "{}";
 | 
				
			||||||
            exec = "${statusScript}";
 | 
					          exec = "${pkgs.playerctl-status}/bin/playerctl-status";
 | 
				
			||||||
            on-click = "${playerctl} play-pause";
 | 
					          on-click = "${pkgs.playerctl}/bin/playerctl --ignore-player=mpd play-pause";
 | 
				
			||||||
          interval = 1;
 | 
					          interval = 1;
 | 
				
			||||||
          tooltip = false;
 | 
					          tooltip = false;
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue