Add ability to cycle windows in 'Present Windows' using Tab key
Needs ReviewPublic

Authored by blzq on Dec 8 2019, 2:44 PM.

Details

Reviewers
romangg
Group Reviewers
KWin
VDG
Summary

Currently, the Tab key in 'Present Windows' has no effect. This patch provides a crude method to cycle through the available windows using Tab.

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
blzq created this revision.Dec 8 2019, 2:44 PM
Restricted Application added a subscriber: kwin. · View Herald TranscriptDec 8 2019, 2:44 PM
blzq requested review of this revision.Dec 8 2019, 2:44 PM
ngraham added a subscriber: ngraham.

In principle I think this makes sense, but in practical usage, I find that it's much faster to use the existing arrow key navigation feature to navigate spatially between windows rather than tab-tab-tab-tab through them all until you find the right now. Thoughts?

blzq added a comment.Dec 8 2019, 5:52 PM

My personal use case for this is mostly after typing to filter the windows, since there's usually only a couple at that point, so I wouldn't have to move my hand to the arrow keys. I agree in general the arrow keys are better especially when there's many windows open.

ngraham accepted this revision as: VDG.Dec 9 2019, 4:00 PM

Ah ok, that makes sense. I can see how using the tab key is natural and sane after filtering on windows. Let's see what the KWin people say.

effects/presentwindows/presentwindows.cpp
1806

Braces go on the same line as the while loop

broulik added a subscriber: broulik.Dec 9 2019, 4:19 PM

What about Shift+Tab / BackTab to cycle in reverse?

blzq updated this revision to Diff 71152.Dec 10 2019, 5:12 AM

Adjust brace in while loop

blzq marked an inline comment as done.Dec 12 2019, 3:13 PM

What about Shift+Tab / BackTab to cycle in reverse?

As far as I could tell there's no modifiers on any of the other keys, so I wasn't sure about behavior consistency for Shift-Tab

I think you can check for if Shift is also pressed in the handler for Qt::Key_Tab, or maybe there's a better way, but it can be done.

blzq updated this revision to Diff 71411.Dec 13 2019, 4:54 AM

Add support for BackTab and Shift+Tab to cycle in reverse

I also think offering Alt+Tab here as alternative makes sense.

Please adhere to code styling https://community.kde.org/Policies/Frameworks_Coding_Style
then it can get merged.

romangg requested changes to this revision.Dec 13 2019, 7:53 AM
This revision now requires changes to proceed.Dec 13 2019, 7:53 AM
blzq added a comment.Dec 13 2019, 8:10 AM

I also think offering Alt+Tab here as alternative makes sense.

Please adhere to code styling https://community.kde.org/Policies/Frameworks_Coding_Style
then it can get merged.

About code style, do you mean having braces around one line if statements? I tried to follow the surrounding code but should I just modify the rest of the file then?

blzq added a comment.Dec 13 2019, 8:18 AM

Also, for Alt+Tab maybe it should function same as the Alt+Tab switcher so when it's released it automatically selects the highlighted window?

blzq updated this revision to Diff 73247.Jan 11 2020, 5:30 AM

Fix coding style. Alt+Tab switches to the highlighted window.