#!/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%"
