-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add audio-setup/teardown scripts to home manager
- Loading branch information
1 parent
ae0a819
commit 5a00b0a
Showing
4 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
|
||
set +o pipefail # Disable pipefail | ||
|
||
HOST=$(hostnamectl hostname) | ||
|
||
# Enable sidetone | ||
mic-loopback on | ||
mic-loopback set 120 | ||
|
||
# Optimise PipeWire Quantum for OBS Studio; prevent audio crackling | ||
case "${HOST}" in | ||
vader) pw-metadata --name settings 0 clock.force-quantum 64;; | ||
phasma) pw-metadata --name settings 0 clock.force-quantum 64;; | ||
*) pw-metadata --name settings 0 clock.force-quantum 1024;; | ||
esac | ||
|
||
# Pause all audio players | ||
playerctl -p cider pause || true | ||
playerctl -p Lodge_iPad pause || true | ||
|
||
rhythmbox-client --no-start --set-volume 0 | ||
rhythmbox-client --no-start --pause | ||
rhythmbox-client --no-start --shuffle | ||
rhythmbox-client --no-start --repeat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ pkgs, ... }: | ||
let | ||
name = builtins.baseNameOf (builtins.toString ./.); | ||
shellApplication = pkgs.writeShellApplication { | ||
inherit name; | ||
runtimeInputs = with pkgs; [ | ||
coreutils-full | ||
pipewire | ||
playerctl | ||
procps | ||
rhythmbox | ||
]; | ||
text = builtins.readFile ./${name}.sh; | ||
}; | ||
in | ||
{ | ||
home.packages = with pkgs; [ shellApplication ]; | ||
} |
13 changes: 13 additions & 0 deletions
13
home-manager/_mixins/scripts/audio-teardown/audio-teardown.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
rhythmbox-client --no-start --pause | ||
rhythmbox-client --no-start --no-repeat | ||
rhythmbox-client --no-start --no-shuffle | ||
rhythmbox-client --no-start --set-volume 0 | ||
|
||
# Restore PipeWire Quantum | ||
pw-metadata --name settings 0 clock.force-quantum 0 | ||
|
||
# Disable sidetone | ||
mic-loopback set 100 | ||
mic-loopback off |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ pkgs, ... }: | ||
let | ||
name = builtins.baseNameOf (builtins.toString ./.); | ||
shellApplication = pkgs.writeShellApplication { | ||
inherit name; | ||
runtimeInputs = with pkgs; [ | ||
coreutils-full | ||
pipewire | ||
rhythmbox | ||
]; | ||
text = builtins.readFile ./${name}.sh; | ||
}; | ||
in | ||
{ | ||
home.packages = with pkgs; [ shellApplication ]; | ||
} |