first Version
This commit is contained in:
commit
0c4bef47e8
149 changed files with 32273 additions and 0 deletions
36
backup/eww/scripts/volume.sh
Executable file
36
backup/eww/scripts/volume.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash
|
||||
|
||||
min_volume="0"
|
||||
max_volume="100"
|
||||
|
||||
# Check if an argument is provided
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Error: Number argument is missing."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Retrieve the argument value
|
||||
number_to_add=$1
|
||||
|
||||
# Validate if the argument is a number
|
||||
if ! [[ $number_to_add =~ ^-?[0-9]+$ ]]; then
|
||||
echo "Error: Invalid number argument."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read the current brightness value from the file
|
||||
current_volume=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2 * 100}')
|
||||
|
||||
# Add the desired number to the current brightness
|
||||
new_volume=$((current_volume + number_to_add))
|
||||
|
||||
# Enforce minimum and maximum brightness values
|
||||
if (( new_volume < min_volume )); then
|
||||
new_volume=$min_volume
|
||||
elif (( new_volume > max_volume )); then
|
||||
new_volume=$max_volume
|
||||
fi
|
||||
|
||||
wpctl set-volume @DEFAULT_AUDIO_SINK@ "${new_volume}%"
|
||||
|
||||
eww update volumeValue="$new_volume"
|
Loading…
Add table
Add a link
Reference in a new issue