Skip to content

Commit

Permalink
Adjusted and added options to audio-ctrl script
Browse files Browse the repository at this point in the history
- Added get_mut option to fetch current mute status
- Added unmute function to unmute if muted
- Adjusted to unmute if muted and volume change requested

Signed-off-by: Kajus Naujokaitis <[email protected]>
  • Loading branch information
kajusnau authored and humaidq-tii committed Oct 11, 2024
1 parent fd31a80 commit ffd35e2
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions packages/audio-ctrl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,31 @@ writeShellApplication {
text = ''
export PULSE_SERVER=audio-vm:4713
unmute() {
if [[ "$(pamixer --get-mute)" == "true" ]]; then
pamixer -t
fi
}
case "$1" in
inc)
# Unmute if muted
unmute
# Increase volume by 5%
pamixer -i 5
;;
dec)
# Unmute if muted
unmute
# Decrease volume by 5%
pamixer -d 5
;;
mut)
# Toggle mute
if [ "$(pamixer --get-mute)" = "false" ]; then
pamixer -m
else
pamixer -u
fi
pamixer -t
;;
get_mut)
pamixer --get-mute
;;
get)
# Get current volume level
Expand All @@ -34,6 +43,10 @@ writeShellApplication {
set)
# Set volume to a specific level
if [ -n "$2" ]; then
# Unmute if muted
if [[ "$(pamixer --get-mute)" == "true" ]]; then
pamixer -t
fi
pamixer --set-volume "$2"
fi
;;
Expand Down

0 comments on commit ffd35e2

Please sign in to comment.