keyboard: fall back to tecla for layout preview, hide menu actions for missing tools - #13878
keyboard: fall back to tecla for layout preview, hide menu actions for missing tools#13878Fantu wants to merge 2 commits into
Conversation
|
lmde7 test seems fails for unrelated issue |
|
Pushed an additional commit that improves Wayland support: the layout preview now only considers
so even where libgnomekbd is still installed, the preview was broken on Wayland. With this change:
Session detection uses |
|
note: about d/control changes need to choose if only add tecla to deps (will be used only in wayland session for now) and keep gkbd-capplet as libgnomekbd still present in actual stable version of ubuntu and remove it only for debian 14; or if remove gkbd-capplet now and use already tecla also on xorg session |
gkbd-keyboard-display comes from libgnomekbd, which is unmaintained and being removed from distributions (GNOME replaced it with tecla in 45, Debian is dropping libgnomekbd). It is also an X11-only GTK3 program: in a Wayland session it just aborts with "Error initializing GTK: Unable to open display", even when libgnomekbd is still installed, so the layout preview was unavailable there. cinnamon-settings already hid the layout preview button (in the "Add layout" dialog) and the "Test layout" button when gkbd-keyboard-display was missing, silently dropping the feature. Fall back to tecla when gkbd-keyboard-display is not installed, and hide the buttons only when neither program is available. gkbd-keyboard-display stays preferred where present, since tecla only renders a standard pc105 geometry (this addresses the TODO removed from InputSources.py). As tecla is a GTK4 program it also works under Wayland, restoring the preview there. On Wayland gkbd-keyboard-display is not considered at all: the preview uses tecla when available, and the preview/test buttons and the applet menu entry are hidden otherwise. Session detection uses Meta.is_wayland_compositor() in the applet and util.get_session_type() in cinnamon-settings. tecla is invoked with a single "layout+variant" argument: '+' is accepted as the layout/variant separator by every tecla version (space and tab only since tecla 48), so it is used unconditionally. The keyboard applet added its "Show Keyboard Layout" menu entry unconditionally, so with no preview program installed clicking it only produced an "Execution of 'gkbd-keyboard-display' failed" error notification. It now uses the same lookup and fallback, and the entry is hidden when no preview program is available. Assisted-by: Claude Code:claude-opus-5
…missing The applet added the "Show Character Table" menu entry unconditionally and spawned gucharmap on click. gucharmap is not necessarily installed (in Debian it is only a Recommends of cinnamon), and when missing the click only produced an "Execution of 'gucharmap' failed" error notification, the same failure mode just fixed for "Show Keyboard Layout". Hide the entry when gucharmap is not present. The separator above these two entries is now added only when at least one of them is shown, so it is not left dangling when neither program is available. Assisted-by: Claude Code:claude-opus-4-8
612a047 to
f74370b
Compare
|
thanks for the review, change done |
Background
gkbd-keyboard-displaycomes from libgnomekbd, which is unmaintained and being removed from distributions: GNOME replaced it with tecla in GNOME 45, and Debian is in the process of removing libgnomekbd entirely. It is also an X11-only GTK3 program, so the keyboard layout preview was already unavailable under Wayland.1. Layout preview: fall back to tecla
The layout preview button (in the "Add layout" dialog) and the "Test layout" button were already hidden when
gkbd-keyboard-displaywas missing — the feature was simply lost. This PR makes them fall back totecla, hiding the buttons only when neither program is available.gkbd-keyboard-displaystays preferred when installed, since tecla only renders a standard pc105 geometry (this addresses theTODOcomment removed fromInputSources.py). Because tecla is a GTK4 program it also works under Wayland, restoring the preview there.tecla is invoked with a single
layout+variantargument.+is accepted as the layout/variant separator by every tecla version (verified against the tecla 46 and 50 sources,tecla_model_new_from_layout_name); space and tab were only added in tecla 48, so+is used unconditionally for backward compatibility (Ubuntu 24.04 / Mint 22 ship tecla 46).2. Applet: hide actions when the target program is missing
The keyboard applet added its "Show Keyboard Layout" menu entry unconditionally: with no preview program installed, clicking it just popped an "Execution of 'gkbd-keyboard-display' failed" error notification. It now uses the same lookup/fallback as cinnamon-settings and the entry is hidden when no preview program is available.
A second commit applies the same guard to "Show Character Table" (
gucharmap), which has the identical failure mode when gucharmap is not installed.Possible future improvement
tecla ≥ 47 accepts a
--parent-handleoption to attach the preview window to a parent as a modal dialog. This could be used from the two cinnamon-settings dialogs (it doesn't apply to the applet, which has no parent GTK window), but it requires exporting the GTK window handle on Wayland/X11 and has nogkbd-keyboard-displayequivalent, so it's left out of this PR to keep the fallback simple.