This commit is contained in:
41666 2025-05-22 15:34:17 -07:00
parent 77b02b6d8d
commit e2604dddd0
8 changed files with 48 additions and 12 deletions

View file

@ -0,0 +1,51 @@
{ pkgs, ... }: let
amixer = "${pkgs.alsa-utils}/bin/amixer";
script = pkgs.writeScriptBin "scarlett-air" ''
#!${pkgs.stdenv.shell}
which=0
controlName=""
newValue=$${1:-2}
find_control() {
for i in /dev/snd/controlC*; do
r=$(${amixer} controls -c $which | grep "name='Line In 2 Air Capture Enum'")
if [[ -z $r ]]; then
((which++))
continue
else
break
fi
echo "found: $r"
controlName=$r
done
}
for n in {1..30}; do
find_control
if [[ -z $controlName ]]; then
echo "control not found this loop, waiting..."
sleep 1s
continue
fi
${amixer} cset -c $which "$controlName" "$newValue" && exit 0
done
'';
in {
home.packages = [
script
];
# systemd.user.services.scarlett-air = {
# enable = true;
# wantedBy = [ "graphical-session.target" ];
# description = "Enables yellow Air on the DAC";
# serviceConfig = {
# Type = "oneshot";
# ExecStart = "${script}/bin/scarlett-air";
# };
# };
}

View file

@ -7,6 +7,7 @@
../../features/vesktop
../../features/retroarch.nix
../../features/wallpaper.nix
../../features/scarlett-air.nix
];
home.packages = with pkgs; let