shod icon indicating copy to clipboard operation
shod copied to clipboard

Question: How to get behaviour similar to Alt+Tab in Windows

Open aspizu opened this issue 3 years ago • 4 comments

With shodc focus -n it only cycles between two containers, if theres more than two then they won't be cycled thru. shodc focus -c -n doesn't help either. I want to cycle thru all the containers just like how Alt+Tab and Alt+Shift+Tab work in Windows.

aspizu avatar Aug 28 '22 17:08 aspizu

Performing alt-tab via a remote controller (shodc) is kind of a botch, because the window manager cannot know when the user is done cycling the containers for it to reorganize the focus history so that the next time the user presses alt-tab, the previously focused container can raise above the others.

The most obvious solution is to implement alt-tab in shod itself (by using the modifier supplied via -m in case the user prefers to press win-tab rather than alt-tab) rather via X11 messages. I'm working on this solution now.

phillbush avatar Aug 29 '22 13:08 phillbush

also show a small preview when switching containers thru the modifier.

aspizu avatar Aug 29 '22 15:08 aspizu

also show a small preview when switching containers thru the modifier.

Miniatures/previews would require lots of code and can be done by a different application, like alttab.

Basically, there are two ways the Alt-Tab behavior can be implemented: as a list of windows (with miniatures or not); or by pushing the actual windows back and forth on the window stack. The first option can be done by a second application (shod exports its list of windows/containers, so application can easily read it). The second option, however, has to be done by the wm itself, because only the window manager has direct control over the stack of windows.

I made some changes to shod that can make this second option (kinda) work. You can bind (using sxhkd(1) or other program) Alt-Tab to shodc focus -cp and Alt-Shift-Tab to shodc focus -cn. This will not work as in Windows™, however. I'll work on that later.

But, if miniatures is more of your thing, you can use alttab (the program I linked above).

phillbush avatar Aug 29 '22 21:08 phillbush

shod focus -cp lets you walk thru all the containers, but shod focus -cn only does it for the top two containers. I've binded Super+N to shod focus -cp and it works as Alt+Tab for me.

aspizu avatar Aug 30 '22 09:08 aspizu

I just implemented alt-tab.

I also reworked on the code and split it into some files (rather than a single large one).
Found and fixed some bugs while doing that.

phillbush avatar Sep 11 '22 19:09 phillbush

thanks

aspizu avatar Sep 13 '22 05:09 aspizu