2023-08-06 21:04:56 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-10-24 16:00:57 +00:00
|
|
|
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
2023-08-06 21:04:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Source minimal predefined functions and variables
|
|
|
|
# to ensure as much performance as possible.
|
2023-09-04 10:46:11 +00:00
|
|
|
. /etc/profile.d/001-functions
|
2023-08-06 21:04:56 +00:00
|
|
|
|
|
|
|
VOLUME=$(get_setting "audio.volume")
|
|
|
|
MAX_VOLUME=100
|
|
|
|
MIN_VOLUME=0
|
|
|
|
STEP=10
|
|
|
|
|
|
|
|
case ${1} in
|
|
|
|
"+"|"up")
|
|
|
|
VOLUME=$(( ${VOLUME} + ${STEP} ))
|
|
|
|
;;
|
|
|
|
"-"|"down")
|
|
|
|
VOLUME=$(( ${VOLUME} - ${STEP} ))
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
VOLUME=${1}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if (( ${VOLUME} < ${MIN_VOLUME} ))
|
|
|
|
then
|
|
|
|
VOLUME=${MIN_VOLUME}
|
|
|
|
elif (( ${VOLUME} > ${MAX_VOLUME} ))
|
|
|
|
then
|
|
|
|
VOLUME=${MAX_VOLUME}
|
2023-08-07 11:13:20 +00:00
|
|
|
elif [ -z "${VOLUME}" ]
|
2023-08-07 00:30:11 +00:00
|
|
|
then
|
|
|
|
VOLUME=60
|
2023-08-06 21:04:56 +00:00
|
|
|
fi
|
|
|
|
|
2023-08-07 12:02:33 +00:00
|
|
|
pactl -- set-sink-volume @DEFAULT_SINK@ ${VOLUME}%
|
2023-08-06 21:04:56 +00:00
|
|
|
set_setting "audio.volume" ${VOLUME}
|