Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Issue with Keyboard Brightness Notifications on Qtile (Key Bindings for F2 and F3)

32 views
Skip to first unread message

fork_me_maybe

unread,
Nov 6, 2024, 5:48:51 AM11/6/24
to qtile-dev

Hi everyone,

I’m trying to set up keyboard brightness control with notifications on my Qtile setup. Here’s what I’ve done so far:

  • I’ve created key bindings for F2 and F3 to adjust the keyboard backlight brightness using commands that modify /sys/class/leds/asus::kbd_backlight/brightness.

  • I want a notification to appear each time I adjust the brightness, with different icons for "Brightness Off" and "Brightness On".

  • My current key bindings look like this:

    Key([], "F2", lazy.spawn("bash -c 'echo 0 > /sys/class/leds/asus::kbd_backlight/brightness && notify-send -u normal -i $HOME/.config/dunst/icons/keyboard-backlight-low.png \"Keyboard Backlight\" \"Brightness Off\"'")),
    Key([], "F3", lazy.spawn("bash -c 'echo 1 > /sys/class/leds/asus::kbd_backlight/brightness && notify-send -u normal -i $HOME/.config/dunst/icons/keyboard-backlight-high.png \"Keyboard Backlight\" \"Brightness On\"'")),

  • However, I’m not seeing any notifications when I press F2 or F3. I’ve verified that notify-send works in other scripts, and I also confirmed the icons are in $HOME/.config/dunst/icons.

  • What I’ve Tried:

  • Checked the icon paths to make sure they’re correct.
  • Tested the notify-send command directly in the terminal, and it works as expected.

Question: Is there anything I might be missing in the key binding configuration, or is there another way I could troubleshoot this? Any help would be appreciated!

Thank you!

fork_me_maybe

unread,
Nov 6, 2024, 6:00:12 AM11/6/24
to qtile-dev
Sorry, My current key bindings look like this

Key([], "F2", lazy.spawn("bash -c 'echo 0 > /sys/class/leds/asus::kbd_backlight/brightness && notify-send -u normal -i /home/odd/.config/dunst/icons/keyboard-backlight-off.png " " ' "),
Key([], "F3", lazy.spawn("bash -c 'echo 1 > /sys/class/leds/asus::kbd_backlight/brightness' && notify-send -u normal -i /home/odd/.config/dunst/icons/keyboard-backlight-on.png " " ' "),

Tycho Andersen

unread,
Nov 6, 2024, 2:45:48 PM11/6/24
to qtil...@googlegroups.com
On Wed, Nov 06, 2024 at 03:00:11AM -0800, fork_me_maybe wrote:
> Sorry, My current key bindings look like this
>
> Key([], "F2", lazy.spawn("bash -c 'echo 0 >
> /sys/class/leds/asus::kbd_backlight/brightness && notify-send -u normal -i
> /home/odd/.config/dunst/icons/keyboard-backlight-off.png " " ' "),
> Key([], "F3", lazy.spawn("bash -c 'echo 1 >
> /sys/class/leds/asus::kbd_backlight/brightness' && notify-send -u normal -i
> /home/odd/.config/dunst/icons/keyboard-backlight-on.png " " ' "),

My guess is that you don't have write perms to
/sys/class/leds/asus::kbd_backlight/brightness; we distribute some
udev rules
https://docs.qtile.org/en/stable/manual/install/index.html#udev-rules
if you want to try those, they should help.

Tycho

Piyush Chaudhary

unread,
Nov 7, 2024, 4:05:51 AM11/7/24
to qtile-dev
I think you misunderstood, the backlight control is working (it is turning on and off) but the notification is not getting sent.

Kai Stian Olstad

unread,
Nov 7, 2024, 6:18:26 AM11/7/24
to qtil...@googlegroups.com
On 06.11.2024 12:00, fork_me_maybe wrote:
> Sorry, My current key bindings look like this
>
> Key([], "F2", lazy.spawn("bash -c 'echo 0 >
> /sys/class/leds/asus::kbd_backlight/brightness && notify-send -u normal
> -i /home/odd/.config/dunst/icons/keyboard-backlight-off.png " " ' "),

You are missing a ) at the end to close the Key.
And the 2 double quote after the png need to be escaped with a
backslash.

> Key([], "F3", lazy.spawn("bash -c 'echo 1 >
> /sys/class/leds/asus::kbd_backlight/brightness' && notify-send -u
> normal -i /home/odd/.config/dunst/icons/keyboard-backlight-on.png " " '
> "),

You are missing a ) at the end to close the Key.
And the 2 double quote after the png need to be escaped with a
backslash.
You have a since quote after brightness that should not be there.

--
Kai Stian Olstad

fork_me_maybe

unread,
Nov 7, 2024, 7:28:00 AM11/7/24
to qtile-dev
Thnx it's working now. Can't beleive i made such a newbie mistake.
Reply all
Reply to author
Forward
0 new messages