From 685a7948a55d70f8808d5ef92822bf7862948f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Tyrychtr?= Date: Thu, 7 Nov 2024 13:45:03 +0100 Subject: [PATCH] backlight: Allow operating the keyboard backlight slider by keyboard Also, hide its menu item from the a11y tree, similarly to the volume and other sliders. Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6894 Part-of: --- js/ui/status/backlight.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/js/ui/status/backlight.js b/js/ui/status/backlight.js index a6ececc13..105aabc47 100644 --- a/js/ui/status/backlight.js +++ b/js/ui/status/backlight.js @@ -55,6 +55,14 @@ const SliderItem = GObject.registerClass({ this.notify('value'); } + + vfunc_key_press_event(event) { + const key = event.get_key_symbol(); + if (key === Clutter.KEY_Left || key === Clutter.KEY_Right) + return this._slider.vfunc_key_press_event(event); + else + return super.vfunc_key_press_event(event); + } }); const DiscreteItem = GObject.registerClass({ @@ -163,6 +171,10 @@ class KeyboardBrightnessToggle extends QuickMenuToggle { this._sliderItem = new SliderItem(); this.menu.box.add_child(this._sliderItem); + const sliderAccessible = this._sliderItem._slider.get_accessible(); + sliderAccessible.set_parent(this.menu.box.get_accessible()); + this._sliderItem.set_accessible(sliderAccessible); + this._discreteItem = new DiscreteItem(); this.menu.box.add_child(this._discreteItem);