diff --git a/home.nix b/home.nix index 1ebcb35..9682b29 100644 --- a/home.nix +++ b/home.nix @@ -65,6 +65,7 @@ ./home/obs ./home/picom.nix ./home/redshift.nix + ./home/sound-levels-maintainer ./home/starship ./home/stylix ./home/syncthing diff --git a/home/sound-levels-maintainer/default.nix b/home/sound-levels-maintainer/default.nix new file mode 100644 index 0000000..d6051d7 --- /dev/null +++ b/home/sound-levels-maintainer/default.nix @@ -0,0 +1,15 @@ +# Maintain input/output gain/volume levels +{ + pkgs, + osConfig, + ... +}: let + isBoar = osConfig.networking.hostName == "boar"; + sound-levels-maintainer = pkgs.writers.writeBashBin "sound-levels-maintainer" ( + if isBoar + then (builtins.readFile ./scripts/sound-levels-maintainer-boar.sh) + else (builtins.readFile ./scripts/sound-levels-maintainer-flexbox.sh) + ); +in { + home.packages = [sound-levels-maintainer]; +} diff --git a/home/sound-levels-maintainer/scripts/sound-levels-maintainer-boar.sh b/home/sound-levels-maintainer/scripts/sound-levels-maintainer-boar.sh new file mode 100644 index 0000000..c88be9d --- /dev/null +++ b/home/sound-levels-maintainer/scripts/sound-levels-maintainer-boar.sh @@ -0,0 +1,17 @@ +set -euo pipefail + +VIRTUAL_SPEAKER_ID=86 +OBS_MIC_ID=92 + +wpctl set-volume $VIRTUAL_SPEAKER_ID 1.0 +wpctl set-volume $OBS_MIC_ID 1.0 + +while true; do + current_volume_virtual_speaker=$(wpctl get-volume $VIRTUAL_SPEAKER_ID | awk '{print $2}') + current_volume_obs_mic=$(wpctl get-volume $OBS_MIC_ID | awk '{print $2}') + + [ "$current_volume_virtual_speaker" != "1.0" ] && wpctl set-volume $VIRTUAL_SPEAKER_ID 1.0 + [ "$current_volume_obs_mic" != "1.0" ] && wpctl set-volume $OBS_MIC_ID 1.0 + + sleep 1 +done