Bug 408806

Summary: [RFE] provide API to override keybindings
Product: [Plasma] kwin Reporter: Konstantin Kharlamov <Hi-Angel>
Component: scriptingAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED WORKSFORME    
Severity: normal CC: lalochcz
Priority: NOR    
Version First Reported In: 5.16.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Konstantin Kharlamov 2019-06-16 21:48:32 UTC
Right now the only way to bind an action to a key is by creating a new action, even if there's already one that does the same thing.

It would be great if instead an extension could override a keybinding.

First: this would allow to provide a set of predefined actions for kwin-tiling extension. Tiling managers are associated not only with "tiling ability", but also with consistent set of keybindings. So the extension could provide e.g. "i3-like" config for those migrating from i3, etc.

Second: this would allow to group relevant actions in a single config. Right now if a user has 10 virtual desktops, then to re-bind "focus virtual desktop n" one has to 1. Find the combination in systemsettings5 2. Press the action label to make "overriding" window popup 3. Press the "override" 4. Press the hotkey. 5. Dismiss the window. This needs to be repeated 10 times! And then again for "move window to desktop n" action. With a text editor this could be solved much faster.

See also: https://github.com/kwin-scripts/kwin-tiling/issues/163
Comment 1 Martin Flöser 2019-06-17 06:57:21 UTC
This is outside the scope of KWin. And kglobalaccel already supports such use cases through the dbus API. You can reassign as you wish through dbus, allowing you to shell script.
Comment 2 Konstantin Kharlamov 2019-06-28 13:07:27 UTC
(In reply to Martin Flöser from comment #1)
> This is outside the scope of KWin. And kglobalaccel already supports such
> use cases through the dbus API. You can reassign as you wish through dbus,
> allowing you to shell script.

Thanks. But I've been told that KWin scripts can not execute dbus commands, that there was callDBus function, but it doesn't work anymore. Then, how should KWin script call dbus?
Comment 3 Konstantin Kharlamov 2019-06-28 13:23:26 UTC
(In reply to Konstantin Kharlamov from comment #2)
> (In reply to Martin Flöser from comment #1)
> > This is outside the scope of KWin. And kglobalaccel already supports such
> > use cases through the dbus API. You can reassign as you wish through dbus,
> > allowing you to shell script.
> 
> Thanks. But I've been told that KWin scripts can not execute dbus commands,
> that there was callDBus function, but it doesn't work anymore. Then, how
> should KWin script call dbus?

Nvm, turns out the configuration dialog for script is implemented as part of kcmshell, so that's where the functional is required.