Skip to content

Wrong device detected for the keyboard backlight #1164

@braska

Description

@braska

Describe the bug
Hyprpanel uses ls -w1 /sys/class/leds | grep '::kbd_backlight$' | head -1 to detect screen device and later use it in --device flag for brightnessctl. This code is based on certain assumptions that are not always true. For example, on my Macbook with T2 Linux (NixOS) I see this:

# command
ls -w1 /sys/class/leds

# result:

# input2::capslock
# input2::compose
# input2::kana
# input2::numlock
# input2::scrolllock
# :white:kbd_backlight

Particularly, grep '::kbd_backlight$' is problematic. It filters out :white:kbd_backlight and doesn't pick it.

Because of that Hyprpanel can't detect that I have controllable keyboard brightness.

To Reproduce
🤷

Expected behavior
I would expect some kind of fallback. E.g. HyprPanel could do (ls -w1 /sys/class/leds | grep '::kbd_backlight$' || ls -w1 /sys/class/leds | grep ':white:kbd_backlight$') | head -1

Desktop (please complete the following information):

  • Distribution: NixOS
  • Window Manager/Desktop Environment: Hyprland

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions