blob: 4531c1642fdddc0462012a1ae221fb9924c10287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/bin/sh
# Get the current brightness level as a percentage
brightness=$(brightnessctl g)
max_brightness=$(brightnessctl m)
# Perform float division and store the result with 2 decimal points
result=$(awk "BEGIN { printf \"%.2f\", $brightness / $max_brightness }")
# Convert the result to a percentage (multiply by 100) and round to the nearest whole number
percentage=$(awk "BEGIN { printf \"%.0f\", $result * 100 }")
# Set the icon based on the brightness level
if [ $percentage -le 33 ]; then
icon=""
elif [ $percentage -le 66 ]; then
icon=""
else
icon=""
fi
echo "$icon $percentage%"
|