commands to change audio device

This commit is contained in:
Tyler Starr 2025-06-08 13:07:00 -07:00
parent 33fbf6214b
commit 0f5d7dbf86
3 changed files with 11 additions and 2 deletions

View File

@ -215,6 +215,8 @@ in {
} // generate_custom_keybindings {
"Bass" = { binding = "<Super><Control>b"; command = "sv -9"; name = "Set Subwoofer to -9dB"; };
"Treble" = { binding = "<Super><Control>t"; command = "sv -20"; name = "Set Subwoofer to -20dB"; };
"Living" = { binding = "<Super><Control>l"; command = "ss Dragon"; name = "Set Audio to Living Room"; };
"Desk" = { binding = "<Super><Control>d"; command = "ss Starship"; name = "Set Audio to Desk"; };
};
};
};

View File

@ -26,8 +26,10 @@ in {
o = "C-M-9";
};
util = {
b = "C-M-b";
t = "C-M-t";
b = "C-M-b"; # Set subwoofer to -9dB
t = "C-M-t"; # Set subwoofer to -20dB
l = "C-M-l"; # Set audio source to living room speakers
d = "C-M-d"; # Set audio source to desk speakers/headphones
};
alt = {
h = "left";

View File

@ -15,6 +15,11 @@ in {
#!/bin/sh
pySVS 54:B7:E5:57:1A:7B --volume=A | grep -oP "(?<=VOLUME': )-?\\d+" > /tmp/svs
'')
(pkgs.writeScriptBin "ss" ''
#!/bin/sh
sink=$(wpctl status | awk '/Audio/{flag=1} /Video/{flag=0} flag' | awk '/Sinks:/{flag=1; next} /Sources:/{flag=0} flag' | grep -E "$1" | awk '{for(i=1;i<=NF;i++) if ($i ~ /^[0-9]+\.$/) { print int($i); exit }}')
wpctl set-default "$sink"
'')
];
services.usbmuxd.enable = true; # for iOS mounting as storage
};