Skip to content

Commit

Permalink
feat(sound-levels-maintainer): init
Browse files Browse the repository at this point in the history
  • Loading branch information
workflow committed Nov 20, 2024
1 parent c920751 commit d6e378c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
./home/obs
./home/picom.nix
./home/redshift.nix
./home/sound-levels-maintainer
./home/starship
./home/stylix
./home/syncthing
Expand Down
15 changes: 15 additions & 0 deletions home/sound-levels-maintainer/default.nix
Original file line number Diff line number Diff line change
@@ -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];
}
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit d6e378c

Please sign in to comment.