# Key bindings for brightness control using `light`.
# Displays a notification with the current value if /usr/bin/notify-send is available
#
# Brightness increase/decrease step can be customized by setting the `$brightness_step`
# variable to a numeric value before including the file.
#
# Requires:     light
# Recommends:   libnotify

set $brightness_notification_cmd  command -v notify-send >/dev/null && \
        VALUE=$(light) && VALUE=${VALUE%%.*} && \
        notify-send -e -h string:x-canonical-private-synchronous:brightness \
            -h "int:value:$VALUE" -t 800 "Brightness: ${VALUE}%"

bindsym XF86MonBrightnessDown exec \
        'STEP="$brightness_step" && light -U ${STEP:-5} && $brightness_notification_cmd'
bindsym XF86MonBrightnessUp exec \
        'STEP="$brightness_step" && light -A ${STEP:-5} && $brightness_notification_cmd'
