Implements the ability to close windows from the various non-default window switchers using the F4 or w keys.
CCBUG: 308331
davidedmundson |
Plasma | |
VDG |
Implements the ability to close windows from the various non-default window switchers using the F4 or w keys.
CCBUG: 308331
Apply patch, Alt+tab to activate window switcher, hit F4 or w. The current window closes.
This works for all but the "Informative" switcher, which is still broken for all keyboard navigation (unrelated to this patch; once that's fixed, this will start working).
No Linters Available |
No Unit Test Coverage |
Buildable 4957 | |
Build 4975: arc lint + arc unit |
I'm also having trouble getting the same approach to work for the default Breeze switcher, which lives in plasma-workspace. Keyboard navigation with the arrow keys works, so the event handler is functional. But I can't seem to target the model for some reason.
You can do control+w with
if (event.matches(StandardKey.Close)) {
}
alt+f4 would need some exposing on the kwin side as that's not a "standard key" exposed via the QPT
I agree with David: please don't hardcode the key. Please don't use "W" - it has no meaning in a window manager, it's just the shortcut in some applications, others use Ctrl+Q and localized it could be something completely different.
I suggest to implement this in KWin and intercept the shortcut hold by kwin - if it matches close the window.
Good point, guys. I'll start with StandardKey.Close for now and see about making the KWin changes later (I'll admit I'm a bit intimidated by KWin's codebase!).
I would prefer if the standardKey.Close is not used. This is an in-application shortcut used by Qt, but not necessarily by GTK or other toolkits. It is not used by the window manager. Please don't mix in-application shortcuts and global shortcuts. It would be confusing to users.
Isn't the in-application shortcut for window closing exactly what the user would expect? From another perspective, the implementation of this feature in other window managers and other platforms (macOS, GNOME) uses the same window-closing shortcut in the switcher, so it seems that this is what is expected and common.
And how do you know the in-application shortcut of a window? What's for example the in application close window shortcut of Konsole or xterm? There simply is no universal shortcut. Also our default shortcut for Qt application is ctrl+q which simply is impossible to press in an alt+tab session.