Introduce a command line option to disable any kind of global shortcuts
ClosedPublic

Authored by graesslin on Dec 2 2018, 12:21 PM.

Details

Summary

This command line option is useful for KWin in embedded use case. That
is when KWin is just used as a compositor for one application instead of
a complete desktop environment. In such a setup global shortcuts are not
wanted and interfere with the application. E.g. one does not want Alt+F4
to close the window, that would render the system unusable.

This change introduces a command line option and disables the following
event filters and spies:

  • global shortcuts
  • modifier only shortcuts
  • terminate session
  • virtual terminal switching
  • screen edges

KGlobalAccel still gets inited, otherwise the (non-functional) binary
would be launched when KWin registers it's global shortcuts.

Test Plan

New test added based on existing tests for the global
shortcuts, ctest passes

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Dec 2 2018, 12:21 PM
Restricted Application added a project: KWin. · View Herald TranscriptDec 2 2018, 12:21 PM
Restricted Application added a subscriber: kwin. · View Herald Transcript
graesslin requested review of this revision.Dec 2 2018, 12:21 PM

when KWin is just used as a compositor for one application

Do you have a specific use case in mind?

when KWin is just used as a compositor for one application

Do you have a specific use case in mind?

Yes, as I wrote: embedded systems with just a fullscreen window.

A more concrete example is the old idea of using KWin in sddm.

apol added a subscriber: apol.Dec 3 2018, 12:28 PM

Wouldn't this make more sense as a KConfig setting to override through kiosk?

In D17304#370672, @apol wrote:

Wouldn't this make more sense as a KConfig setting to override through kiosk?

The same cannot be achieved with kiosk as:

  • there is no way to globally disable kglobalaccel
  • vt switching cannot be disabled
  • screenedges are cumbersome, e.g. need to be configured on the effect basis
  • mouse shortcuts cannot be disabled through kconfig
  • touch gestures cannot be disabled through kconfig

The same cannot be achieved with kiosk as:

That's answering the question of whether it can be achieved with kiosk right now with the existing settings.

It definitely is do-able, we can read a bool from a config file just as easily as we can read a bool from a command line arg. It's a two line change on top of this patch.

It's certainly a valid question depending on the specific use-cases and where this patchset is heading wrt disabling other features.

If this does have a use for admins, it makes sense to be consistent with every other inhibition; and we could even add the same key in kglobalaccel_x11.


RE: SDDM

I was probing to see if you were thinking of that.
I still haven't decided where I want to go, there's a few options with pros and cons. I should start a discussion somewhere about it.

Well, I would certainly not want to expose a config option to disable VT switching. I think for e.g. a Plasma session that's a must have, for an embedded system it's a no-go.

The idea for this change is inspired by some requirements from $work. We provide a machine control interface and use kwin_wayland as the Wayland compositor (touch input, but also keyboard and mouse present). Obviously I can configure the system in a way that it's unbreakable, but the average KWin user would not know how to do it. And even if I had kiosk it would not be the best solution as I also use this on the dev system. To test the Wayland session I can just run kwin_wayland in my normal session. With kiosk I would have to mess around with my system, with the command line switch I get what I need. KWin is really awesome for such a use case and way easier to setup than e.g. QtCompositor. This change would make it just a little bit easier for such setups. Granted it's not the most common use case, but it might be something interesting to explore.

davidedmundson accepted this revision.Dec 3 2018, 8:49 PM
This revision is now accepted and ready to land.Dec 3 2018, 8:49 PM
This revision was automatically updated to reflect the committed changes.