Add old dotfiles
This commit is contained in:
commit
1cace80e48
192 files changed
+13538
No files matched your search
Executable
+52
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
|
||||
function get_brightness {
|
||||
cntb=$(brightnessctl g)
|
||||
maxb=$(brightnessctl m)
|
||||
|
||||
echo $(( ($cntb * 100) / $maxb ))
|
||||
}
|
||||
|
||||
# Function to get the icon based on the brightness level
|
||||
function get_brightness_icon {
|
||||
brightness_level=$1
|
||||
if [ $brightness_level -le 33 ]; then
|
||||
echo ""
|
||||
elif [ $brightness_level -le 66 ]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to set the contents of "/tmp/brightness_status" to the current brightness level
|
||||
function set_tmp_brightness_status {
|
||||
brightness_level=$(get_brightness)
|
||||
icon=$(get_brightness_icon $brightness_level)
|
||||
echo "$icon $brightness_level%" > /tmp/brightness_status
|
||||
}
|
||||
|
||||
function send_notification {
|
||||
brightness_level=$(get_brightness)
|
||||
icon=$(get_brightness_icon $brightness_level)
|
||||
# Make the bar with the special character ─ (it's not dash -)
|
||||
# https://en.wikipedia.org/wiki/Box-drawing_character
|
||||
bar=$(seq -s "─" $(($brightness_level / 5)) | sed 's/[0-9]//g')
|
||||
# Send the notification
|
||||
dunstify -i display-brightness-symbolic -t 2500 -r 2593 -u normal " $bar"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
up)
|
||||
# Set the brightness level up (+ 5%)
|
||||
brightnessctl s 5%+
|
||||
send_notification
|
||||
set_tmp_brightness_status
|
||||
;;
|
||||
down)
|
||||
# Set the brightness level down (- 5%)
|
||||
brightnessctl s 5%-
|
||||
send_notification
|
||||
set_tmp_brightness_status
|
||||
;;
|
||||
esac
|
||||
Reference in new issue
Block a user