first Version
This commit is contained in:
commit
0c4bef47e8
149 changed files with 32273 additions and 0 deletions
38
backup/eww/scripts/brightness.sh
Executable file
38
backup/eww/scripts/brightness.sh
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/bin/bash
|
||||
|
||||
brightness_file="/sys/class/backlight/intel_backlight/brightness"
|
||||
min_brightness=1
|
||||
max_brightness=96000
|
||||
|
||||
# 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_brightness=$(cat "$brightness_file")
|
||||
|
||||
# Add the desired number to the current brightness
|
||||
new_brightness=$((current_brightness + number_to_add))
|
||||
|
||||
# Enforce minimum and maximum brightness values
|
||||
if (( new_brightness < min_brightness )); then
|
||||
new_brightness=$min_brightness
|
||||
elif (( new_brightness > max_brightness )); then
|
||||
new_brightness=$max_brightness
|
||||
fi
|
||||
|
||||
# Write the new brightness value back to the file
|
||||
echo "$new_brightness" >> "$brightness_file"
|
||||
|
||||
eww update brightnessValue="$new_brightness"
|
Loading…
Add table
Add a link
Reference in a new issue