#!/bin/bash case $1 in up) brightnessctl set 10%+ ;; down) brightnessctl set --min-value=1 10%- ;; off) brightnessctl set 0 ;; max) brightnessctl set 100% ;; esac ID_LOCATION=/run/user/$(id -u)/i3-helpers/brightness-notification-id OLD_ID=$(<"$ID_LOCATION") BRIGHTNESS=$(( $(brightnessctl get) * 100 / $(brightnessctl max) )) NEW_ID=$(dunstify --appname=brightness.sh --timeout=3000 --hints="int:value:$BRIGHTNESS" --printid "${OLD_ID:+--replace="${OLD_ID}"}" "Brightness" "${BRIGHTNESS}%" ) mkdir -p $(dirname "$ID_LOCATION") echo "$NEW_ID" >"$ID_LOCATION"