awawa
This commit is contained in:
parent
77b02b6d8d
commit
e2604dddd0
8 changed files with 48 additions and 12 deletions
51
home-manager/features/scarlett-air.nix
Normal file
51
home-manager/features/scarlett-air.nix
Normal 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";
|
||||
# };
|
||||
# };
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue