[Linux] Use pulsemixer for volume control

This commit is contained in:
2018-06-04 13:47:37 -07:00
parent f5525df0bc
commit 4538ff4c6b
4 changed files with 20 additions and 13 deletions

View File

@@ -10,7 +10,8 @@ function switch_sink_applications()
}
current_default=$(pahelper.sh list | grep '*' | all_after_char ":" | xargs)
environment_variable_exists USE_ONLY_ONE_PASINK && pahelper.sh "$current_default"
environment_variable_exists USE_ONLY_O_PASINK && pahelper.sh "$current_default"
pulseaudio-ctl "$@"
# XXX: this does not prevent volumes higher than 100
pulsemixer "$@"
pashowvolume

View File

@@ -60,7 +60,6 @@ function get_linux_distro {
return 1
}
function is_osx() {
if command_exists uname; then
case `uname` in
@@ -82,3 +81,7 @@ function source_directory_files {
source "$filename"
done
}
function min {
[ $1 -le $2 ] && echo "$1" || echo "$2"
}

View File

@@ -13,7 +13,7 @@ pasink() {
pavolume () {
pacmd list-sinks |
awk '/^\s+name: /{indefault = $2 == "<'"$(pasink)"'>"}
/^\s+volume: / && indefault {print $5; exit}'
/^\s+volume: / && indefault {print $5; exit}' | grep -Eo "[0-9]*"
}
paismuted () {
@@ -24,7 +24,7 @@ pashowvolume () {
if paismuted; then
volnoti-show -m
else
volnoti-show "$(pavolume)"
volnoti-show "$(min $(pavolume) 100)"
fi
}