#!/usr/bin/env bash ACTION="$1" NOTIFICATION_TIME=1000 case "$ACTION" in volume-up) pactl set-sink-volume @DEFAULT_SINK@ +5% VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}') notify-send -e -h string:x-canonical-private-synchronous:audio \ -h "int:value:$VALUE" -t $NOTIFICATION_TIME "🔊 Volume" "${VALUE}%" ;; volume-down) pactl set-sink-volume @DEFAULT_SINK@ -5% VALUE=$(pactl get-sink-volume @DEFAULT_SINK@ | head -n 1 | awk '{print substr($5, 1, length($5)-1)}') notify-send -e -h string:x-canonical-private-synchronous:audio \ -h "int:value:$VALUE" -t $NOTIFICATION_TIME "🔉 Volume" "${VALUE}%" ;; mute-toggle) pactl set-sink-mute @DEFAULT_SINK@ toggle MUTED=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') if [ "$MUTED" = "yes" ]; then notify-send -e -h string:x-canonical-private-synchronous:audio \ -t $NOTIFICATION_TIME "🔇 Audio Muted" "Output muted" else notify-send -e -h string:x-canonical-private-synchronous:audio \ -t $NOTIFICATION_TIME "🔊 Audio Unmuted" "Output active" fi ;; mic-mute-toggle) pactl set-source-mute @DEFAULT_SOURCE@ toggle MUTED=$(pactl get-source-mute @DEFAULT_SOURCE@ | awk '{print $2}') if [ "$MUTED" = "yes" ]; then notify-send -e -h string:x-canonical-private-synchronous:audio \ -t $NOTIFICATION_TIME "🎤 Microphone Muted" "Mic muted" else notify-send -e -h string:x-canonical-private-synchronous:audio \ -t $NOTIFICATION_TIME "🎤 Microphone Active" "Mic unmuted" fi ;; brightness-up) brightnessctl s 10%+ # Get current and max brightness values CURRENT=$(brightnessctl get) MAX=$(brightnessctl max) PERCENT=$((CURRENT * 100 / MAX)) notify-send -e -h string:x-canonical-private-synchronous:brightness \ -h "int:value:$PERCENT" -t $NOTIFICATION_TIME "☀️ Brightness" "${PERCENT}%" ;; brightness-down) brightnessctl s 10%- # Get current and max brightness values CURRENT=$(brightnessctl get) MAX=$(brightnessctl max) PERCENT=$((CURRENT * 100 / MAX)) notify-send -e -h string:x-canonical-private-synchronous:brightness \ -h "int:value:$PERCENT" -t $NOTIFICATION_TIME "🔅 Brightness" "${PERCENT}%" ;; *) echo "Usage: $0 {volume-up|volume-down|mute-toggle|mic-mute-toggle|brightness-up|brightness-down}" exit 1 ;; esac