[NixOS] Only use backlight class in brightness.sh
This commit is contained in:
@@ -5,8 +5,8 @@ ARG="${1:-}"
|
|||||||
|
|
||||||
# Function to get current brightness percentage
|
# Function to get current brightness percentage
|
||||||
get_brightness_percentage() {
|
get_brightness_percentage() {
|
||||||
# Get list of devices
|
# Get list of display backlight devices only (filter by class 'backlight')
|
||||||
local devices=$(brightnessctl --list 2>/dev/null | cut -d' ' -f2 | cut -d"'" -f2)
|
local devices=$(brightnessctl --list 2>/dev/null | grep 'class.*backlight' | cut -d' ' -f2 | cut -d"'" -f2)
|
||||||
local device_count=$(echo "$devices" | wc -w)
|
local device_count=$(echo "$devices" | wc -w)
|
||||||
|
|
||||||
if [ "$device_count" -eq 0 ]; then
|
if [ "$device_count" -eq 0 ]; then
|
||||||
@@ -59,8 +59,8 @@ if [ -n "$ARG" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to apply to all devices
|
# Try to apply to all devices
|
||||||
# First, try to get list of devices
|
# Get list of display backlight devices only (filter by class 'backlight')
|
||||||
DEVICES=$(brightnessctl --list 2>/dev/null | cut -d' ' -f2 | cut -d"'" -f2)
|
DEVICES=$(brightnessctl --list 2>/dev/null | grep 'class.*backlight' | cut -d' ' -f2 | cut -d"'" -f2)
|
||||||
|
|
||||||
if [ -n "$DEVICES" ]; then
|
if [ -n "$DEVICES" ]; then
|
||||||
# Apply to each device
|
# Apply to each device
|
||||||
|
|||||||
Reference in New Issue
Block a user