SUMMARY For example, QMLKonsole uses Settings.tabletMode to determine if the key toolbar is shown. This doesn't work in Flatpak which makes the application unusable.
Probably need to export it in the portal settings.
Makes sense. What's the way forward to trigger this? I guess it should be aligned with Gnome etc as well?
Huh. This is a bit complicated. So tablet mode (or as we call it in the GUI: touch mode) is ultimately controlled by kwin and currently kirigami talks directly to kwin. The easy fix is to have relevant apps talk-name=org.kde.KWin but that is a bit questionable from a security POV what with kwin being the wayland compositor. The reasonable, albeit more invasive, fix is to restructure how things work. The settings portal should talk to Kwin and abstract the tabletmode setting. Kirigami should then talk to the portal rather than kwin. Flatpak apps equally talk to the portal. IOW: everything needs to talk to the portal and the portal talks to kwin.
As it turns out this also affects Kirigami.InputMethod which is backed by kwin also. Both those interfaces need exposing through the settings portal.
*Sigh* this looked easy but alas, it's not. TabletMode we could make work through the settings portal. InputMethod on the other hand needs to write to properties, to activate a virtual keyboard for example, and the settings portal doesn't support writing settings. That leaves us with a bunch of not so lovely options: a) make a virtualkeyboard portal (that may be the smartest thing long term?) b) let apps talk to kwin (seems silly from a security POV) c) add a supplemental portal that proxies between kwin and the flatpak so as to reduce exposure of kwin interfaces (i.e. talk=org.kde.VirtualKeyboard rather than talk=org.kde.KWin -- with the former playing proxy to kwin) d) add a proprietary write function to our settings portal (kinda crap because then the flatpak needs to talk to our portal impl directly, again raising concerns over security and breaking abstraction)
Agree that A & C look like a better design but require more work.
If `talk-name=org.kde.KWin` works as a workaround right now then it's not ideal (Kwin/KDE session only) but could be a temporary workaround. Which apps are impacted?
TabletMode impacts all kirigami apps (it adjusts the UI to be more friendly for touch inputs) VirtualKeyboard appears only used in plasma-* right now.
>InputMethod on the other hand needs to write to properties, to activate a virtual keyboard for example, and the settings portal doesn't support writing settings. It's exposed, but is it used? I know Inputmethod.willShowOnActive is used but that is read only. Worth checking if this is a non-issue before starting too much.
Not used from what I can find. But we do expose the API in Kirigami, so... option e) retract mutability of InputMethod.enabled and InputMethod.active in Kirigami for KF6 and use Settings portal for reading all settings
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/982
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/983
Also https://invent.kde.org/plasma/xdg-desktop-portal-kde/-/merge_requests/174
Git commit 27da4afe3488a222a6e4a56787abb440515d081b by Harald Sitter. Committed on 06/03/2023 at 09:44. Pushed by sitter into branch 'master'. make InputMethod immutable previously enabled and active were writable properties which complicated abstraction inside application sandboxes. to solve this problem we no longer consider them writable in KF6 and consider their writability deprecated in KF5. active is controllable through Qt's IM API and enabled shouldn't really be touched by random applications anyway this then allows us to eventually back them using the XDG Settings portal instead of talking to KWin directly. M +0 -20 src/inputmethod.cpp M +2 -4 src/inputmethod.h M +0 -30 src/libkirigami/virtualkeyboardwatcher.cpp M +2 -4 src/libkirigami/virtualkeyboardwatcher.h https://invent.kde.org/frameworks/kirigami/commit/27da4afe3488a222a6e4a56787abb440515d081b
Git commit 5d9499250a2c8bc9b716efdbd7c956f5043e45ca by Aleix Pol Gonzalez, on behalf of Harald Sitter. Committed on 08/03/2023 at 16:07. Pushed by sitter into branch 'master'. implement settings for org.kde.TabletMode and .VirtualKeyboard they each reflect a part of settings that reside in kwin M +3 -0 src/CMakeLists.txt A +18 -0 src/org.kde.KWin.TabletModeManager.xml A +30 -0 src/org.kde.KWin.VirtualKeyboard.xml M +128 -0 src/settings.cpp https://invent.kde.org/plasma/xdg-desktop-portal-kde/commit/5d9499250a2c8bc9b716efdbd7c956f5043e45ca
Git commit 560d71422bbe563454859895c42e5090c7d5bd23 by Harald Sitter. Committed on 17/03/2023 at 12:58. Pushed by sitter into branch 'master'. move from kwin API to portal API instead of directly talking to org.kde.KWin talk to org.freedesktop.portal.Desktop's Settings interface. This allows us to abstract the actual implementation of those interfaces, and more importantly allows us to not have all kirigami apps talk to our wayland compositor and get access to literally all its dbus functionality M +2 -2 src/libkirigami/CMakeLists.txt A +18 -0 src/libkirigami/dbustypes.h [License: LGPL(v2.0+)] A +27 -0 src/libkirigami/org.freedesktop.portal.Settings.xml D +0 -13 src/libkirigami/org.kde.KWin.TabletModeManager.xml D +0 -45 src/libkirigami/org.kde.KWin.VirtualKeyboard.xml M +25 -24 src/libkirigami/tabletmodewatcher.cpp M +55 -66 src/libkirigami/virtualkeyboardwatcher.cpp https://invent.kde.org/frameworks/kirigami/commit/560d71422bbe563454859895c42e5090c7d5bd23