extract pulse_sink script
This commit is contained in:
		
							parent
							
								
									43a1960e18
								
							
						
					
					
						commit
						690ab81d76
					
				
					 5 changed files with 20 additions and 18 deletions
				
			
		| 
						 | 
					@ -24,10 +24,11 @@
 | 
				
			||||||
    _diffr = [ diffr ];
 | 
					    _diffr = [ diffr ];
 | 
				
			||||||
    kak-pager = [ fish final._diffr ];
 | 
					    kak-pager = [ fish final._diffr ];
 | 
				
			||||||
    terminal = [ alacritty ];
 | 
					    terminal = [ alacritty ];
 | 
				
			||||||
    wpass = [ final.bmenu 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 ];
 | 
				
			||||||
    volumesh = [  pulseaudio libnotify  ];
 | 
					    volumesh = [  pulseaudio libnotify  ];
 | 
				
			||||||
 | 
					    pulse_sink = [  pulseaudio pamixer final.wdmenu ];
 | 
				
			||||||
  } // lib.mapAttrs import_script {
 | 
					  } // lib.mapAttrs import_script {
 | 
				
			||||||
    wdmenu = ./wdmenu.nix;
 | 
					    wdmenu = ./wdmenu.nix;
 | 
				
			||||||
    wlauncher = ./wlauncher.nix;
 | 
					    wlauncher = ./wlauncher.nix;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										12
									
								
								scripts/pulse_sink
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								scripts/pulse_sink
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,12 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					output=$(printf "HDMI\nHeadphones" | wdmenu -i -p "Output:")
 | 
				
			||||||
 | 
					vol=$(pamixer --get-volume)
 | 
				
			||||||
 | 
					case "$output" in
 | 
				
			||||||
 | 
					    HDMI)
 | 
				
			||||||
 | 
					        pactl set-default-sink alsa_output.pci-0000_07_00.1.hdmi-stereo-extra1
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					    Headphones)
 | 
				
			||||||
 | 
					        pactl set-default-sink alsa_output.pci-0000_09_00.4.analog-stereo
 | 
				
			||||||
 | 
					        ;;
 | 
				
			||||||
 | 
					esac
 | 
				
			||||||
 | 
					pamixer --set-volume "$vol"
 | 
				
			||||||
| 
						 | 
					@ -4,7 +4,7 @@ set -xe
 | 
				
			||||||
find_file() {
 | 
					find_file() {
 | 
				
			||||||
  fd --strip-cwd-prefix '\.gpg$' |
 | 
					  fd --strip-cwd-prefix '\.gpg$' |
 | 
				
			||||||
  sd ".gpg$" "" |
 | 
					  sd ".gpg$" "" |
 | 
				
			||||||
  bmenu -p "Password" $@
 | 
					  wdmenu -p "Password" $@
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main() {
 | 
					main() {
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ main() {
 | 
				
			||||||
    username=`pass show "$entry" 2>/dev/null | perl -ne 'print $2 if /^(login|user|email): (.*)/'`
 | 
					    username=`pass show "$entry" 2>/dev/null | perl -ne 'print $2 if /^(login|user|email): (.*)/'`
 | 
				
			||||||
    password=`pass show "$entry" 2>/dev/null | head -n 1`
 | 
					    password=`pass show "$entry" 2>/dev/null | head -n 1`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    action=`printf "Autotype\nUsername -> $username\nPassword" | bmenu -p Action`
 | 
					    action=`printf "Autotype\nUsername -> $username\nPassword" | wdmenu -p Action`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    case $action in
 | 
					    case $action in
 | 
				
			||||||
        Autotype)
 | 
					        Autotype)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,6 +31,9 @@ in {
 | 
				
			||||||
  home.packages = with pkgs; [
 | 
					  home.packages = with pkgs; [
 | 
				
			||||||
    terminal # see flake.nix
 | 
					    terminal # see flake.nix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pulse_sink
 | 
				
			||||||
 | 
					    pulseaudio
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ## CLI
 | 
					    ## CLI
 | 
				
			||||||
    btop
 | 
					    btop
 | 
				
			||||||
    exa
 | 
					    exa
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,20 +9,6 @@ let
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    notify-send "$(wl-paste)" "Copied to clipboard"
 | 
					    notify-send "$(wl-paste)" "Copied to clipboard"
 | 
				
			||||||
  '';
 | 
					  '';
 | 
				
			||||||
  pulse_sink = pkgs.writeShellScriptBin "pulse_sink" ''
 | 
					 | 
				
			||||||
    #!/bin/sh
 | 
					 | 
				
			||||||
    output=$(printf "HDMI\nHeadphones" | wdmenu -i -p "Output:")
 | 
					 | 
				
			||||||
    vol=$(${pkgs.pamixer}/bin/pamixer --get-volume)
 | 
					 | 
				
			||||||
    case "$output" in
 | 
					 | 
				
			||||||
        HDMI)
 | 
					 | 
				
			||||||
            pactl set-default-sink alsa_output.pci-0000_07_00.1.hdmi-stereo-extra1
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
        Headphones)
 | 
					 | 
				
			||||||
            pactl set-default-sink alsa_output.pci-0000_09_00.4.analog-stereo
 | 
					 | 
				
			||||||
            ;;
 | 
					 | 
				
			||||||
    esac
 | 
					 | 
				
			||||||
    ${pkgs.pamixer}/bin/pamixer --set-volume "$vol"
 | 
					 | 
				
			||||||
  '';
 | 
					 | 
				
			||||||
  _lock = pkgs.writeShellScriptBin "_lock" ''
 | 
					  _lock = pkgs.writeShellScriptBin "_lock" ''
 | 
				
			||||||
    swaylock -f
 | 
					    swaylock -f
 | 
				
			||||||
    systemctl --user start swayidle.service
 | 
					    systemctl --user start swayidle.service
 | 
				
			||||||
| 
						 | 
					@ -152,7 +138,7 @@ in {
 | 
				
			||||||
            "escape" = "";
 | 
					            "escape" = "";
 | 
				
			||||||
            "q" = "";
 | 
					            "q" = "";
 | 
				
			||||||
            "m" = "exec volumesh -t";
 | 
					            "m" = "exec volumesh -t";
 | 
				
			||||||
            "s" = "exec ${pulse_sink}/bin/pulse_sink";
 | 
					            "s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
 | 
				
			||||||
          };
 | 
					          };
 | 
				
			||||||
          passthrough = {
 | 
					          passthrough = {
 | 
				
			||||||
            "${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
 | 
					            "${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue