mirror of
https://github.com/xsghetti/HyprCrux.git
synced 2025-07-02 21:30:39 -04:00
hyprpm/hyprlock
This commit is contained in:
parent
d4376c8ddf
commit
e973ebbc15
39 changed files with 2500 additions and 7 deletions
45
.config/hypr/scripts/brightnesscontrol.sh
Executable file
45
.config/hypr/scripts/brightnesscontrol.sh
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
ScrDir=`dirname "$(realpath "$0")"`
|
||||
source $ScrDir/globalcontrol.sh
|
||||
|
||||
function print_error
|
||||
{
|
||||
cat << "EOF"
|
||||
./brightnesscontrol.sh <action>
|
||||
...valid actions are...
|
||||
i -- <i>ncrease brightness [+5%]
|
||||
d -- <d>ecrease brightness [-5%]
|
||||
EOF
|
||||
}
|
||||
|
||||
function send_notification {
|
||||
brightness=`brightnessctl info | grep -oP "(?<=\()\d+(?=%)" | cat`
|
||||
brightinfo=$(brightnessctl info | awk -F "'" '/Device/ {print $2}')
|
||||
angle="$(((($brightness + 2) / 5) * 5))"
|
||||
ico="~/.config/dunst/icons/vol/vol-${angle}.svg"
|
||||
bar=$(seq -s "." $(($brightness / 15)) | sed 's/[0-9]//g')
|
||||
dunstify "t2" -i $ico -a "$brightness$bar" "$brightinfo" -r 91190 -t 800
|
||||
}
|
||||
|
||||
function get_brightness {
|
||||
brightnessctl -m | grep -o '[0-9]\+%' | head -c-2
|
||||
}
|
||||
|
||||
case $1 in
|
||||
i) # increase the backlight by 5%
|
||||
brightnessctl set +5%
|
||||
send_notification ;;
|
||||
d) # decrease the backlight by 5%
|
||||
if [[ $(get_brightness) -lt 5 ]] ; then
|
||||
# avoid 0% brightness
|
||||
brightnessctl set 1%
|
||||
else
|
||||
# decrease the backlight by 5%
|
||||
brightnessctl set 5%-
|
||||
fi
|
||||
send_notification ;;
|
||||
*) # print error
|
||||
print_error ;;
|
||||
esac
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue