pkgs: change-audio: 0.2.0 -> 0.3.0

Only boost audio beyond 100% if specifically asked for.
This commit is contained in:
Bruno BELANYI 2022-02-18 12:12:29 +01:00
parent 8d4bbaf886
commit cc12148dac
2 changed files with 18 additions and 5 deletions

View file

@ -9,13 +9,26 @@ NOTIFY=(
) )
do_change_volume() { do_change_volume() {
local args=()
if [ "$1" = "up" ]; then if [ "$1" = "up" ]; then
upDown="-i" args+=("-i")
else else
upDown="-d" args+=("-d")
fi
shift
# Do not boost over 100% unless explitily asked for
if [ "$1" = "--force" ] || [ "$1" = "-f" ]; then
args=("--allow-boost" "${args[@]}")
shift
fi fi
pamixer --allow-boost "$upDown" "$2" # Volume
args+=("$1")
pamixer "${args[@]}"
newVolume="$(pamixer --get-volume || true)" newVolume="$(pamixer --get-volume || true)"
[ "$(pamixer --get-volume-human)" = "muted" ] && isMuted=true [ "$(pamixer --get-volume-human)" = "muted" ] && isMuted=true
@ -29,7 +42,7 @@ do_change_volume() {
} }
do_toggle() { do_toggle() {
args=() local args=()
if [ "${2:-audio}" = mic ]; then if [ "${2:-audio}" = mic ]; then
args+=(--default-source) args+=(--default-source)
MSG="Toggled microphone" MSG="Toggled microphone"

View file

@ -1,7 +1,7 @@
{ lib, libnotify, makeWrapper, pamixer, shellcheck, stdenvNoCC }: { lib, libnotify, makeWrapper, pamixer, shellcheck, stdenvNoCC }:
stdenvNoCC.mkDerivation rec { stdenvNoCC.mkDerivation rec {
pname = "change-audio"; pname = "change-audio";
version = "0.2.0"; version = "0.3.0";
src = ./change-audio; src = ./change-audio;