Added proxmox ssh-configsconfig/.scripts/sound.sh now shows mute state while changing volume/also corrected display of volume levelcompton -> picom in config/.config/i3/config

This commit is contained in:
TuDatTr
2020-09-19 13:49:26 +02:00
parent 87bfeb8da7
commit 2968f25fc1
7 changed files with 158 additions and 36 deletions

View File

@@ -4,25 +4,35 @@ type pactl >/dev/null 2>&1 || { echo >&2 "I require pactl but it's not installed
type amixer >/dev/null 2>&1 || { echo >&2 "I require amixer but it's not installed. Aborting."; exit 1; }
type dunstify >/dev/null 2>&1 || { echo >&2 "I require dunstify but it's not installed. Aborting."; exit 1; }
function isMuted() {
if amixer get Master | grep -q off; then
muted=0;
else
muted=1;
fi
}
defaultSink=$(pactl info | grep 'Default Sink' | cut -d' ' -f3);
curVolume=$(amixer get Master | grep -o \[0-9\]\\+% -m 1);
isMuted;
if [ $muted -eq 1 ]; then echo unmuted; else echo muted; fi
case $1 in
"up"*)
pactl set-sink-volume $defaultSink +5%;
dunstify -r 2 'sound up'\ \($curVolume\);
curVolume=$(amixer get Master | grep -o \[0-9\]\\+% -m 1);
if [ $muted -eq 0 ]; then msg="(muted)"; else msg=""; fi
dunstify -r 2 'sound up'\ \($curVolume\) $msg;
;;
"down"*)
pactl set-sink-volume $defaultSink -5%;
dunstify -r 2 'sound up'\ \($curVolume\);
curVolume=$(amixer get Master | grep -o \[0-9\]\\+% -m 1);
if [ $muted -eq 0 ]; then msg="(muted)"; else msg=""; fi
dunstify -r 2 'sound up'\ \($curVolume\) $msg;
;;
"toggle"*)
msg='muted';
if amixer get Master | grep -q off; then
msg='unmuted';
fi
pactl set-sink-mute $defaultSink toggle;
if [ $muted -eq 0 ]; then msg=unmuted; else msg=muted; fi
dunstify -r 2 'sound'\ $msg;
echo $msg
;;
esac

View File

@@ -25,7 +25,7 @@ function kb_routine {
function battery_routine {
capacity=$(< /sys/class/power_supply/BAT0/capacity)
if [[ $capacity -lt lower_battery_threshold ]]; then
dunstify "$capacity";
acpi | grep -q 'Discharging' && dunstify "$capacity";
fi
}