G-dH / advanced-alttab-window-switcher

A highly customizable replacement for Gnome Shell's Alt-Tab window and app switchers.
GNU General Public License v3.0
163 stars 11 forks source link

[FEATURE] Automatic filter switching in single app mode #79

Open ces42 opened 10 months ago

ces42 commented 10 months ago

Is your feature request related to a problem? Please describe. I have AATWS set to only show windows on the current monitor by default. Sometimes I one window of the same application on each monitor, and I'd like to be able to quickly switch between them by pressing alt+backtick. Currently that only show a single window in the switcher. This feels kind of silly. Why would I ever want to switch between one and the same window?

Describe the solution you'd like If there list of windows that is going to be displayed with a certain filter (monitor, workspace, all) has only one window, "move the filter up one step" until there's more than one window (or we've hit all).

G-dH commented 10 months ago

Added suggested behavior and fixed manual filter switching in the single-app mode.

ces42 commented 10 months ago

Amazing, that was so fast!

Is there a reason you're not just checking itemList.length > 1, regardless of whether we're in single-app mode or not? Also can I ask what the reason for this piece of code (further down in the same function) is?

if (this._searchEntry === null || this._searchEntry === '') {
    ... select first item if firstRun
    if (this._firstRun) {
        this._initialSelectionMode = SelectMode.FIRST;
        this._selectedIndex = 0;
    } else {
...

At least in my use case it would me more useful if pressing alt+backtick were to right away select the other window of the app I'm using instead.

G-dH commented 10 months ago

That piece of code handles several situations including search, so it's not just about the one condition. I need more time to do it right and test it. To the first selection. The code originally handles situations where there are no windows on the current monitor or workspace so the previously used window is the first one, so that's a side effect. I quite like that the first selection stays within the current filter setting even if the temporary filter has changed..

G-dH commented 9 months ago

@ces42 Can you test the latest version?

ces42 commented 9 months ago

The newest version is working fine for me. The previous commit also worked fine. Works as intended and I haven't noticed any bugs. Although I commented out the lines

        this._initialSelectionMode = SelectMode.FIRST;
        this._selectedIndex = 0;

inside that if-statement I mentioned to get faster switching. (I also don't use search so I don't know about that part).

G-dH commented 9 months ago

Thanks for the feedback!

simsilver commented 8 months ago

Could you please make a switch to turn this off and on? In my case, I usually put just a mail app in one monitor, and minimize it, then use app switcher to show it……

but seems just put another random window with it is a good workaround~

G-dH commented 8 months ago

@simsilver The option is not available yet, but I've changed the behavior so it automatically switches the filter only if you press your Tab key again if there is only one item in the list. Available in the repository.