Changes in: bin,dunst,gtk-3.0,gtk-4.0,hypr,waybar,

This commit is contained in:
Gopher 2025-03-22 20:38:29 +05:30
parent 9920450b17
commit 50cc31d4e1
43 changed files with 2807 additions and 215 deletions

View file

@ -1,22 +1,52 @@
#!/bin/sh
# #!/bin/bash
# # I copied this script from JaKooLit. https://github.com/JaKooLit. Because I do not have any laptop to test these kinds of features.
# Use brightnessctl to naturally adjust laptop screen brightness and send a notification
iDIR="$HOME/.config/dunst/icons/brightness"
notification_timeout=1000
currentbrightness=$(brightnessctl -e4 -m | awk -F, '{print substr($4, 0, length($4)-1)}')
if [ "$currentbrightness" -lt 30 ] && [ "$1" = "down" ]; then exit 1; fi
send_notification() {
brightness=$(brightnessctl -e4 -m | awk -F, '{print substr($4, 0, length($4)-1)}')
dunstify -a "Backlight" -u critical -h int:value:"$brightness" -i "brightness" "Brightness" -t 1000
# Get brightness
get_backlight() {
echo $(brightnessctl -m | cut -d, -f4)
}
case $1 in
up)
brightnessctl -e4 set 1%+
send_notification "$1"
# Get icons
get_icon() {
current=$(get_backlight | sed 's/%//')
if [ "$current" -le "20" ]; then
icon="$iDIR/brightness-20.png"
elif [ "$current" -le "40" ]; then
icon="$iDIR/brightness-40.png"
elif [ "$current" -le "60" ]; then
icon="$iDIR/brightness-60.png"
elif [ "$current" -le "80" ]; then
icon="$iDIR/brightness-80.png"
else
icon="$iDIR/brightness-100.png"
fi
}
# Notify
notify_user() {
notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Brightness : $current%"
}
# Change brightness
change_backlight() {
brightnessctl set "$1" -n && get_icon && notify_user
}
# Execute accordingly
case "$1" in
"--get")
get_backlight
;;
down)
brightnessctl -e4 set 1%-
send_notification "$1"
"up")
change_backlight "+10%"
;;
"down")
change_backlight "10%-"
;;
*)
get_backlight
;;
esac