Edited changebrightness script to use new quasilinear (64 exp, 128 lin)
scale Also added prototype changevolume script (not functional yet) and backup changebrightness script because i've just left them out of the repo for ages
This commit is contained in:
parent
93758647f6
commit
1c96195117
|
|
@ -1,7 +1,10 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
bright=`cat /sys/class/backlight/amdgpu_bl0/brightness`
|
# bright=`cat /sys/class/backlight/amdgpu_bl0/brightness` # for use without brightnessctl
|
||||||
|
bright=`brightnessctl g`
|
||||||
state=-1
|
state=-1
|
||||||
thresh=(0 1 3 5 9 15 27 48 84 147 255)
|
# thresh=(0 1 3 5 9 15 27 48 84 147 255) # generated using floor(256^x-1)
|
||||||
|
# thresh=(0 26 51 77 102 128 153 179 204 230 255) # generated using floor(256*x-1)
|
||||||
|
thresh=(0 19 39 60 81 103 126 151 180 214 255) # generated using floor(64^x+192*x-1)
|
||||||
|
|
||||||
for i in ${!thresh[@]}; do
|
for i in ${!thresh[@]}; do
|
||||||
if [[ $bright -ge ${thresh[$i]} ]]
|
if [[ $bright -ge ${thresh[$i]} ]]
|
||||||
|
|
@ -14,7 +17,8 @@ new=$(($1 + $state))
|
||||||
|
|
||||||
if [[ $new -ge 0 ]] && [[ $new -le 10 ]]
|
if [[ $new -ge 0 ]] && [[ $new -le 10 ]]
|
||||||
then
|
then
|
||||||
echo ${thresh[$new]} | tee /sys/class/backlight/amdgpu_bl0/brightness
|
# echo ${thresh[$new]} | tee /sys/class/backlight/amdgpu_bl0/brightness
|
||||||
|
brightnessctl s ${thresh[$new]}
|
||||||
if [[ $? -eq 0 ]] && [[ -f $(which dunstify) ]]
|
if [[ $? -eq 0 ]] && [[ -f $(which dunstify) ]]
|
||||||
then
|
then
|
||||||
dunstify -a "changebrightness.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness -h string:hlcolor:#ffffff -h int:value:$(($new*10)) "Brightness: $new"
|
dunstify -a "changebrightness.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness -h string:hlcolor:#ffffff -h int:value:$(($new*10)) "Brightness: $new"
|
||||||
|
|
|
||||||
23
scripts/changebrightness.sh.bak
Normal file
23
scripts/changebrightness.sh.bak
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
bright=`cat /sys/class/backlight/amdgpu_bl0/brightness`
|
||||||
|
state=-1
|
||||||
|
thresh=(0 1 3 5 9 15 27 48 84 147 255)
|
||||||
|
|
||||||
|
for i in ${!thresh[@]}; do
|
||||||
|
if [[ $bright -ge ${thresh[$i]} ]]
|
||||||
|
then
|
||||||
|
state=$i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
new=$(($1 + $state))
|
||||||
|
|
||||||
|
if [[ $new -ge 0 ]] && [[ $new -le 10 ]]
|
||||||
|
then
|
||||||
|
echo ${thresh[$new]} | tee /sys/class/backlight/amdgpu_bl0/brightness
|
||||||
|
if [[ $? -eq 0 ]] && [[ -f $(which dunstify) ]]
|
||||||
|
then
|
||||||
|
dunstify -a "changebrightness.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness -h string:hlcolor:#ffffff -h int:value:$(($new*10)) "Brightness: $new"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
23
scripts/changevolume.sh
Normal file
23
scripts/changevolume.sh
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Usage: changevolume.sh <device> <-1|0|1>
|
||||||
|
# First argument: device as in wpctl, e.g. @DEFAULT_AUDIO_SINK@ or @DEFAULT_AUDIO_SOURCE@
|
||||||
|
# Second argument: reduce (-1), toggle mute (0), increase (1)
|
||||||
|
|
||||||
|
if [[ $2 -eq 0 ]] then
|
||||||
|
wpctl set-mute $1 toggle
|
||||||
|
if [[ -f $(which dunstify) ]] then
|
||||||
|
dunstify -a "changevolume.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness "Device $1 mute toggled"
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $2 -eq 1 ]] then
|
||||||
|
wpctl set-volume $1 0.05+
|
||||||
|
if [[ -f $(which dunstify) ]] then
|
||||||
|
dunstify -a "changevolume.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness "Device $1 mute toggled"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f $(which dunstify) ]] then
|
||||||
|
dunstify -a "changevolume.sh" -u low -i audio-volume-medium -h string:x-dunst-stack-tag:changevolume $(wpctl get-volume $1)
|
||||||
|
fi
|
||||||
Loading…
Reference in a new issue