init
This commit is contained in:
22
scripts/volume
Executable file
22
scripts/volume
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
MAX_VOLUME=200
|
||||
NOTIFICATION_ID=9999
|
||||
CURRENT_VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
|
||||
|
||||
if [ "$1" == "+" ]; then
|
||||
if [ "$CURRENT_VOLUME" -lt "$MAX_VOLUME" ]; then
|
||||
pactl set-sink-volume @DEFAULT_SINK@ +10%
|
||||
else
|
||||
notify-send -u normal -r $NOTIFICATION_ID "Невозможно увеличить звук" "Достигнут лимит в $MAX_VOLUME%" -t 400
|
||||
exit 0
|
||||
fi
|
||||
elif [ "$1" == "-" ]; then
|
||||
pactl set-sink-volume @DEFAULT_SINK@ -10%
|
||||
else
|
||||
notify-send -u normal -r $NOTIFICATION_ID "Error" "Invalid parameter. Use '+' or '-'." -t 400
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UPDATED_VOLUME=$(pactl get-sink-volume @DEFAULT_SINK@ | grep -oP '\d+%' | head -1 | tr -d '%')
|
||||
notify-send -u normal -i audio-volume-high -r $NOTIFICATION_ID "Уровень звука" "${UPDATED_VOLUME}%" -t 400
|
Reference in New Issue
Block a user