distribution/packages/jelos/sources/scripts/volume
fewtarius 165f994bc1
* Rework profile bits so they are correctly named and sequenced.
* Drop deprecated device.config from AMD64.
* Add a platform quirk for AMD64.x
2023-09-04 10:46:11 +00:00

40 lines
717 B
Bash

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023-present Fewtarius
# Source minimal predefined functions and variables
# to ensure as much performance as possible.
. /etc/profile.d/001-functions
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}
elif [ -z "${VOLUME}" ]
then
VOLUME=60
fi
pactl -- set-sink-volume @DEFAULT_SINK@ ${VOLUME}%
set_setting "audio.volume" ${VOLUME}