Files
NixOS-Configs/home/hypr/quickshell/scripts/get_brightness.sh

13 lines
282 B
Bash
Executable File

#!/usr/bin/env bash
# Read brightness
percent=100
if command -v brightnessctl &>/dev/null; then
percent=$(brightnessctl -m 2>/dev/null | cut -d, -f4 | tr -d '%' | head -n 1)
if [ -z "$percent" ]; then
percent=100
fi
fi
echo "{\"brightness\": ${percent:-100}}"