~tsdh/public-inbox

1

swayr: Alt-Tab like menu switcher?

Simon van der Veldt <simon.vanderveldt@gmail.com>
Details
Message ID
<CAKDzfnqk1=oJtbO19XqOiL=L7=ofyc_uBkSeqmZ_QbsynV8x8g@mail.gmail.com>
DKIM signature
missing
Download raw message
Hi!

First of all thanks for making swayr, very nice to have!
I was wondering if I'm understanding the current situation correctly,
so figured I'd just send a mail.

Is my understanding correct that it currently isn't possible to have
the menu switchers work similarly to pretty much all DE or other OS
alt-tab behavior in that one presses and holds alt and then cycles
through the list of (icons/"screenshots") of the applications using
tab? To be clear, this way every additional press of tab moves on to
the next application and releasing alt results in the switching to the
selected application/window.
As a new user migrating from GNOME I feel like having something like
this would significantly soften the migration and, at least based on
my experience so far, I'd probably prefer this way of switching over
the workspace + window navigation one uses within sway normally.

If this is indeed not possible is this a limitation of sway or swayr?
Or a combination or something else? Would it be possible to make this
work somehow?

Hope this is clear :) If not, please let me know.

Thanks!
Details
Message ID
<87bks8g0ov.fsf@gnu.org>
In-Reply-To
<CAKDzfnqk1=oJtbO19XqOiL=L7=ofyc_uBkSeqmZ_QbsynV8x8g@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
Simon van der Veldt <simon.vanderveldt@gmail.com> writes:

Hi Simon,

> First of all thanks for making swayr, very nice to have!

Thank you!

> Is my understanding correct that it currently isn't possible to have
> the menu switchers work similarly to pretty much all DE or other OS
> alt-tab behavior in that one presses and holds alt and then cycles
> through the list of (icons/"screenshots") of the applications using
> tab?

The keybinding is configurable.  But let's assume you've set

  bindsym Mod1+Tab exec swayr switch-window

which will call "swayr switch-window" when you press Alt+Tab.  From that
time on, it's up to the menu program (wofi or something) how keypresses
are handled.

With wofi, Alt+Tab is not captured, so sequences like Alt+Tab, Alt+Tab,
Alt+Tab will just fire up 3 instances of wofi one after the other which
is not very useful.

However, it seems that Alt+Tab Tab Tab... does pretty much what you
want, i.e., focus inside wofi one window after the other.  It won't
cycle but switch to the input area after focusing the last window in the
list, though.

And to actually select the focused window (in terms of switching to it),
you'd still need to type Return.

Oh, and screenshots instead of just app icons are not supported.  I
guess it would be feasible to somehow create screenshots for all open
windows on invocation time and display them.  However, there's no way to
have updating "screenshots" like in the Gnome Shell where you can watch,
e.g., the compile output in a terminal scrolling by in the switcher.
That's simply not feasible with the "use an external menu program
approach" of swayr.

> If this is indeed not possible is this a limitation of sway or swayr?
> Or a combination or something else?

It's basically a result of having separate programs involved.  With a
desktop environment such as Gnome, the keyboard shortcuts are handled by
the Gnome shell itself and Alt+Tab calls some internal functionality
which then probably knows how it was called.  In our case, you configure
sway that with the press of some key binding some external command (like
swayr) is invoked.  That external command has no clue if it was invoked
by some key binding; from its POV it has just been run by a shell (which
is technically true).  And then swayr itself spawns yet another program
(wofi, rofi, dmenu, bemenu, ...).

> Would it be possible to make this work somehow?

I think the only way to make that work was to implement it directly in
sway.

Or maybe an external command would work too, but it would need to be
configured somehow with "cycle through windows with the XXX key" and
"accept my choice on an YYY-key release event" where XXX would be Tab
and YYY would be Alt in case you want your window switcher should be
called with Alt+Tab.

So maybe it could made work with swayr by making it not use some
external menu program but by implementing one inside swayr itself.  But
I'm not interested in doing that.

Oh, I just found out that you can define which keys are handled by wofi,
see "man 5 wofi" and "man 7 wofi-keys".  But unfortunately for you, I
don't see a way to bind key_submit to the release of Alt_L. :-(

Bye,
Tassilo
Reply to thread Export thread (mbox)