Need help writing an InputFilter to fix ALT-TAB (Twitcher) behaviour for GTK apps

No, it is not possible. Wayland protocol do not provide information are key shortcut handled by application or not. So all key events are consumed and BApplication shortcut handling mechanism is not used.

I believe that such global shortcuts should be handled by operation system itself instead of code that run in each application, even if it is inside libbe.so. input_server add-on or input_server itself is a proper place to do it.

It is technically a hack because application may not know about all existing system shortcuts, including defined in future Haiku versions.

I’ve tried to check for Deskbar’s signature on the struct I’m getting from GetActiveAppInfo, with the intention on breaking inmediately without sending a new message if Switcher is already active (because it will get one from BWindow after the message gets dispatched). Not only it didn’t work, but that change also stops Switcher from showing when a GTK (Wayland) application is active. Am I doing something wrong or is it that Wayland applications are second class citizens and so when one of them is active Haiku somehow thinks that Deskbar is the active application?

EDIT: this would be obviously a hack because I’m managing shortcuts in two places (filter and BWindow). It won’t be needed if we decide to move the global shortcuts away from BWindow and to the input server.

May be a long shot, but have you considered using switcher instead? and also telling it explicitly what you want it to do with commands instead of forwarding keypresses?

EDIT: it seems twitcher (in deskbar) does not have a way to tell it to do something without interpreting the keypresses… ouch

Okay. So Switcher has no problem whatsoever getting the system shortcuts while a GTK application is running… : )

It uses a CaputureWindow to get all keyboard and pointer events all the time. I think this aproach is better, but it would be even nicer if these kinds of constructs could be registered to input_server and then make it forward the messages to avoid having to create this Window in the first place.

EDIT: The SetEventMask already does that. my bad :slight_smile:

I saw Switcher on the code tree and at first I didn’t understand what is was. So it’s apparently an attempt to rewrite Deskbar’s Twitcher as an standalone application. I’m going to compile it and see how it works for me.

In any case, I think the discussion is heading to the right places now :slight_smile:

The default shortcuts for it are a bit confusing, because it really does not behave like tracker currently.

For a start, try ctrl-alt (1 or 2 or 3 or 4) and it will popup a window on the left right top or bottom, with two different usecases.

EDIT: it seems that for some reason messages with a B_FUNCTION_KEY are not send in this scenario? atleast they don’t get printed when trying to dump them in MessageReceived for key down and unmapped key down… so investigating why that is…

It’s planned uo be a lot more than that, I think the general idea is to have dock/panels that pop up on each side of the screen with running apps, not running apps, and maybe recent documents or anything you want to store in it (possibly including replicants).

But, it doesn’t quite do all these things just yet. And sadly no one took much time to continue it. Maybe we should try to write down all the things it should do, and then we can make that a gsoc project?