Allow windows to be closed from the window switchers
Changes PlannedPublic

Authored by ngraham on Nov 15 2018, 2:07 PM.

Details

Reviewers
davidedmundson
Group Reviewers
Plasma
VDG
Summary

Implements the ability to close windows from the various non-default window switchers using the F4 or w keys.

CCBUG: 308331

Test Plan

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).

Diff Detail

Repository
R114 Plasma Addons
Branch
close-windows-from-windowswitcher (branched from master)
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4957
Build 4975: arc lint + arc unit
ngraham created this revision.Nov 15 2018, 2:07 PM
Restricted Application added a project: Plasma. · View Herald TranscriptNov 15 2018, 2:07 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
ngraham requested review of this revision.Nov 15 2018, 2:07 PM
ngraham edited the test plan for this revision. (Show Details)Nov 15 2018, 2:14 PM
ngraham added a subscriber: Zren.

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.

davidedmundson requested changes to this revision.Nov 15 2018, 3:18 PM
davidedmundson added a subscriber: davidedmundson.

you can't hardcode the key combos

This revision now requires changes to proceed.Nov 15 2018, 3:18 PM

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.

ngraham planned changes to this revision.Nov 15 2018, 4:37 PM

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!).

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.

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.

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.