extract pulse_sink script

This commit is contained in:
Leonardo Eugênio 2022-10-21 20:21:51 -03:00
parent 43a1960e18
commit 690ab81d76
5 changed files with 20 additions and 18 deletions

View file

@ -24,10 +24,11 @@
_diffr = [ diffr ];
kak-pager = [ fish final._diffr ];
terminal = [ alacritty ];
wpass = [ final.bmenu fd pass sd wl-clipboard wtype ];
wpass = [ final.wdmenu fd pass sd wl-clipboard wtype ];
screenshotsh =
[ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ];
volumesh = [ pulseaudio libnotify ];
pulse_sink = [ pulseaudio pamixer final.wdmenu ];
} // lib.mapAttrs import_script {
wdmenu = ./wdmenu.nix;
wlauncher = ./wlauncher.nix;

12
scripts/pulse_sink Normal file
View 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"

View file

@ -4,7 +4,7 @@ set -xe
find_file() {
fd --strip-cwd-prefix '\.gpg$' |
sd ".gpg$" "" |
bmenu -p "Password" $@
wdmenu -p "Password" $@
}
main() {
@ -20,7 +20,7 @@ main() {
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`
action=`printf "Autotype\nUsername -> $username\nPassword" | bmenu -p Action`
action=`printf "Autotype\nUsername -> $username\nPassword" | wdmenu -p Action`
case $action in
Autotype)

View file

@ -31,6 +31,9 @@ in {
home.packages = with pkgs; [
terminal # see flake.nix
pulse_sink
pulseaudio
## CLI
btop
exa

View file

@ -9,20 +9,6 @@ let
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" ''
swaylock -f
systemctl --user start swayidle.service
@ -152,7 +138,7 @@ in {
"escape" = "";
"q" = "";
"m" = "exec volumesh -t";
"s" = "exec ${pulse_sink}/bin/pulse_sink";
"s" = "exec ${pkgs.pulse_sink}/bin/pulse_sink";
};
passthrough = {
"${mod}+escape" = "mode default;exec notify-send 'Passthrough off'";