Bug 121349

Summary: Allow direct selection of last active tasks with keystrokes / key combos
Product: [Plasma] kwin Reporter: Lincoln Yeoh <lincoln_yeoh>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED INTENTIONAL    
Severity: wishlist CC: r2ruyu-nana
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Lincoln Yeoh 2006-02-04 11:54:43 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    I Don't Know

I believe most people can at least keep track of the last 4-7 tasks they were doing, and often they actually do need "random access" amongst those 4-7 tasks. 

Given I like my windows maximized (to see the most of what I'm working on), having 4 or more windows sharing the same screen and continuously resizing them seems a bit tiresome. 

So, what would be nice is for the UI to be able to _automatically_ assign key strokes to the last "n" tasks/windows in the "last active/focused" stack. 

alt+0= renumber current stack from most recently used to oldest used (alt+r?) 
alt+1= current window 
alt+2= previous window 
alt+3= window before previous window 
alt+4= ... 

So say you clicked on tasks E, B, A , D, C on the taskbar (or selected them in some other ways), and then pressed alt+0. 

then 
alt+1= C (ssh to a machine X) 
alt+2= D (ssh to a machine Y) 
alt+3= A (some documentation?) 
alt+4= B (notepad of stuff to be copied/pasted from/to machines) 
alt+5= E (edit of source code) 

AND it _stays_ that way until you do alt+0 again. 

So even after you press alt+4 to switch to B, alt+1 still switches to C (until "renumbering" is triggered).

If alt+<number> is too often used by other apps, maybe we could use the "windows" key[1]? e.g. winkey+1 for task 1. 

Then maybe winkey+tab could pop up a _numbered_ list of tasks (like alt-tab but with numbers) that stays up and allows selection by keystroke (1 = task 1, 2 = task 2) and perhaps mouse (reordering of tasks with the mouse is probably not that useful?). I think many people have asked for the selection with mouse thing already. 

But I think adding direct selection of a task with a quick key combo is more useful because the taskbar already allows direct selection with mouse (unless tasks are grouped - I'm don't see the benefits of task grouping but that's just me).

Not sure if winkey+tab should automatically renumber - that might be quite annoying and counterproductive?

Not sure if the context of the task "stack" should be per desktop or across desktops, but I believe the alt+tab stuff already allows that to be customized, so it's probably better done the same way.

Anyway, this is just a "draft" suggestion. Probably needs lots of refinement and thinking through first, I haven't given that much thought to this - usability, long term extensibility, clashes with other stuff etc.

But I really think something like this would be useful.

[1] I'd still prefer that there be a single key reserved for opening up the "start menu", so that we can use a sequence of keystrokes to quickly select amongst customizable folders/items in the menu. 
Example: 
"open start menu" key (opens menu)
2 (opens folder called "2 Tools")
C (opens calculator shortcut)

Or
"open start menu" key (opens menu)
5 (opens folder called "5 ssh")
1 (opens "1 ssh Machine A")

This is already possible with KDE right? 

If the winkey is already used for this, it might not be a good idea to "overload" the winkey with this task selection thing.
Comment 1 Lincoln Yeoh 2006-02-23 08:53:17 UTC
The initial order should probably be set the first time you use any of the "alt+num" keys - for example: an implicit "alt+0/renumbering" occurs, when you use any of the alt keys for the first time (except alt+0 I guess).
Comment 2 Lincoln Yeoh 2008-11-23 18:07:09 UTC
Some notes and additional suggestions.

KDE is already keeping track of past windows clicked/activated (and removing duplicates) for the "alt-tab" feature.

What I'm suggesting is: when the user presses alt+0 (or winkey+0), just look at that list/stack of past windows, and then assign the most recent 9 to alt+1 to alt+9 (or winkey+1 to winkey+9 or whatever works). The windows stay assigned to those keys until alt+0 is pressed again.

The additional thing: 
Perhaps alt+ "=" (equals sign) followed by alt+number would have the current active window replace the corresponding numbered window in the list, so that you can replace windows without doing an alt+0 style renumber (which might be undesirable - once you have stuff nicely remembered :) ).
Comment 3 Martin Flöser 2012-03-11 10:12:02 UTC
I'm sorry to say that I do not see any advantage over the existing Alt+Tab functionality by the requested functionality. In fact I doubt that the human mind is able to properly track the last used applications. To solve this we provide the very flexible alt+tab feature which keeps track of the last used windows and helps the user to select the one he wants to work with.

I want to thank you for your suggestion and I am sorry that no developer had evaluated this request so far.
Comment 4 Lincoln Yeoh 2012-03-13 07:55:48 UTC
I think my explanation wasn't clear enough. Anyway I've implemented a utility which does it on MS Windows: http://sourceforge.net/projects/linkkey/
If you have access to Windows you can test the behaviour out to see what I mean. It allows you to very quickly switch amongst more than 2 windows. Alt-Tab only allows very quick switching between 2 windows or at most 3 windows.

Windows 7 actually has a feature similar to this: winkey+number switches to  application #number (but not window as per my suggestion). 

I don't really use "Desktop Linux" much nowadays, but I hope it improves since Windows 8 appears to be a good opportunity for gaining marketshare.
Comment 5 Thomas Lübking 2012-03-13 17:30:06 UTC
(In reply to comment #4)
> I think my explanation wasn't clear enough.
You ask for an gesture-a-like window stack shortcut setting.
You will probably know, that you can assign shortcuts to windows in kwin (even automatically by rules)

The problem i see with your approach (and what basically seems Martin's concern as well, even if the user does not have to trace activation) is that users will still have to memorize the activation list they created and by this connect windows to numbers (what is harder than eg. assigning ctrl+alt+t to the terminal and ctrl+alt+e to the editor, direct usage of the alt key for automatic global shortcuts is btw., as you suspected, far too invasive and error prone)

So ultimately this should rather come with visual assistance, such as following the taskbar order (apparently what MS does?) or through eg. the present windows effects where numbers wouldn't be used to filter but directly select a window, ideally showing the corresponding number.

* Whether latter would have an actual advantage over activating present windows and selecting a window by the arrow keys and pressing enter is however rather debatable.
* If you want this coordinated with the taskbar items, this needed to be done by the taskbar, not by the window manager (doesn't know anything about taskbar layout and can't control it either)
* Personally i'd consider the additional costs by explicitly setting shortcuts more than justified by the easier to memorize assignment.
Comment 6 Martin Flöser 2012-03-13 20:21:14 UTC
*** Bug 288717 has been marked as a duplicate of this bug. ***