feat: allow keyboard navigation (disabled by default)

superseed and close #1626
This commit is contained in:
Alfredo Monclus committed 2026-02-28 11:49:10 -03:00
1 parent fbaa1e1fd8
commit ab4a48e5c5
4 files changed
+13 -3

No files matched your search

+6
View File
@@ -47,6 +47,12 @@ The options listed here are not editable from within the user interface.
# Start KlipperScreen with the screen locked
# start_locked: False
# Allow the buttons to focus to navigate with the keyboard
# a scroll wheel mapped to tab/shift+tab and enter button can work
# Beware that the UI is coded to be touchscreen controlled, this is secondary and
# not recommended as the only way to control
# keyboard_navigation: False
```
!!! tip
+3 -1
View File
@@ -166,7 +166,9 @@ class KlippyGtk:
def Button(self, image_name=None, label=None, style=None, scale=None, position=Gtk.PositionType.TOP, lines=2):
if self.font_size_type == "max" and label is not None:
image_name = None
b = Gtk.Button(hexpand=True, vexpand=True, can_focus=False, image_position=position, always_show_image=True)
b = Gtk.Button(hexpand=True, vexpand=True, image_position=position, always_show_image=True)
focusable = self.screen._config.get_main_config().getboolean("allow_button_focus", fallback=False)
b.set_can_focus(focusable)
if label is not None:
b.set_label(label.replace("\n", " "))
if image_name is not None:
+2 -1
View File
@@ -162,7 +162,8 @@ class KlipperScreenConfig:
bools = (
'invert_x', 'invert_y', 'invert_z', '24htime', 'only_heaters', 'show_cursor', 'confirm_estop',
'autoclose_popups', 'use_dpms', 'use_default_menu', 'side_macro_shortcut', 'use-matchbox-keyboard',
'show_heater_power', "show_scroll_steppers", "auto_open_extrude", "start_locked"
'show_heater_power', "show_scroll_steppers", "auto_open_extrude", "start_locked",
"keyboard_navigation"
)
strs = (
'default_printer', 'language', 'print_sort_dir', 'theme', 'screen_blanking_printing', 'font_size',
+2 -1
View File
@@ -75,6 +75,7 @@ button {
.active image,
button:active,
button:focus,
.button_active,
button.active {
background-color: @active;
@@ -665,4 +666,4 @@ flowbox button {
keyboard_box {
padding: 0 20em;
}
}