neodotfiles/source/dwmblocks/scripts/block_brightness

31 lines
858 B
Text
Raw Normal View History

2024-03-28 21:40:01 +00:00
#!/usr/bin/env bash
# ***This script was made by Clay Gomera (Drake)***
# - Description: A dwmblocks script to print the current brightness level
# - Dependencies: dwm, dwmblocks, power-profiles-daemon
# this variable will store the current brightness level percentage
brt=$(brightnessctl -m | cut -d, -f4 | tr -d %)
if [ "${brt%.*}" -eq 100 ]; then
icon="󰛨"
elif [ "${brt%.*}" -ge 90 ]; then
icon="󱩖"
elif [ "${brt%.*}" -ge 80 ]; then
icon="󱩕"
elif [ "${brt%.*}" -ge 70 ]; then
icon="󱩔"
elif [ "${brt%.*}" -ge 60 ]; then
icon="󱩓"
elif [ "${brt%.*}" -ge 50 ]; then
icon="󱩒"
elif [ "${brt%.*}" -ge 40 ]; then
icon="󱩑"
elif [ "${brt%.*}" -ge 30 ]; then
icon="󱩐"
elif [ "${brt%.*}" -ge 20 ]; then
icon="󱩏"
else
icon="󱩎"
fi
echo " $icon ${brt%.*}% " # print the icon and brightness level