Skip to content

Support keyboard navigation over multiple monitors in multitasking view#2536

Open
leolost2605 wants to merge 9 commits intomainfrom
leolost/focusable
Open

Support keyboard navigation over multiple monitors in multitasking view#2536
leolost2605 wants to merge 9 commits intomainfrom
leolost/focusable

Conversation

@leolost2605
Copy link
Member

@leolost2605 leolost2605 commented Sep 17, 2025

Instead of manually handling keyboard focus where needed, do it like GTK does it with some adaptations.

We have the FocusController which is added to the "root" focusable of a focus tree (e.g. mtv or window overview).

Then we have the focusable class which is subclassed by the actors in the actor tree where focus is needed. The focusable handles deciding which implementor gets the focus based on the direction.

We now also hide the focus indicator after 5 seconds.

Fixes #2651
Fixes #2648

We can easily add navigation via Tab now too but I would leave that to a follow up

@leolost2605 leolost2605 changed the title Leolost/focusable Support keyboard navigation over multiple monitors in multitasking view Sep 17, 2025
@leolost2605 leolost2605 force-pushed the leolost/focusable branch 4 times, most recently from 919ea31 to 139ae2f Compare November 23, 2025 14:26
@leolost2605 leolost2605 marked this pull request as ready for review November 23, 2025 14:30
@leolost2605 leolost2605 requested a review from a team November 23, 2025 14:32
@leolost2605 leolost2605 force-pushed the leolost/focusable branch 2 times, most recently from d0aa36a to 6507c10 Compare November 26, 2025 15:26
@leolost2605 leolost2605 mentioned this pull request Nov 26, 2025
5 tasks
@danirabbit danirabbit moved this to Needs review in OS 8.1.0 Dec 1, 2025
@danirabbit danirabbit removed this from OS 8.1.0 Dec 15, 2025
@danirabbit danirabbit moved this to Needs review in OS 8.1.1 Dec 15, 2025
@danirabbit
Copy link
Member

@lenemter could you give this a review? :)

@danirabbit danirabbit mentioned this pull request Jan 21, 2026
@@ -10,7 +10,7 @@
* It will propagate gesture events to all direct descendants that are also {@link ActorTarget}s.
* If a new child (or target via {@link add_target}) is added, its progress will be synced.
*/
public class Gala.ActorTarget : Clutter.Actor, GestureTarget {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like adding Focusable here, this intertwines focusable and gestures systems which is counter intuitive

Copy link
Member Author

@leolost2605 leolost2605 Jan 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to kind of grow Focusable into a Gala.Widget someday if we have to add more stuff that is common to most ui parts. I just didn't quite want to commit to calling it that yet but we can do that. I'm not quite sure I understand the counter intutitive part but I'm open to other ideas

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could even merge the actor target into the widget then 🤷

Copy link
Member Author

@leolost2605 leolost2605 Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least something like a MultitaskingViewWidget. Because we need a way to propagate these things through the actor hierarchy and the best way for this is a base class IMHO but like I said I'm open to other suggestions

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that widgets should explicitly implement Focusable.
TBH I spent like 20 minutes to understand how FocusController works with MultitaskingView because I didn't catch that ActorTarget (which is supposed to handle gestures) unexpectedly handles focus state now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ActorTarget (which is supposed to handle gestures) unexpectedly handles focus state now

Well it doesn't handle focus state but it derives from a class that does.

I get what you're saying but we kind of really need a base class otherwise everything will just be a giant hack (at least what I can think of, like I said I'm still very much open to other ideas). And I'm not sure anyone does it differently? Both GNOME Shell and GTK have focus management in the widget base class and do it similar to this PR.
Once again what do you think about introducing a widget? And then renaming ActorTarget to WidgetTarget? This would solve overlooking actortarget extending focusable.
This way widgets also explicitly use focusable because they are using a baseclass that's called Widget(Target) and widgets bring focus management.

@leolost2605 leolost2605 force-pushed the leolost/focusable branch 2 times, most recently from 87170b0 to a57c179 Compare January 30, 2026 18:56
@leolost2605
Copy link
Member Author

@lenemter I've added two commits on top that rename focusable to widget and then actortarget to widget target. Let me know what you think!

@danirabbit danirabbit requested a review from lenemter February 2, 2026 19:54
@lenemter
Copy link
Member

lenemter commented Feb 2, 2026

@leolost2605 I think it would be better to leave ActorTarget as is, rename Focusable to Widget, and make Widget subclass ActorTarget. This way Widget uses gesture infrastructure, not the other way around. What do you think?

@danirabbit danirabbit added this to OS 9 Feb 5, 2026
@danirabbit danirabbit removed this from OS 8.1.1 Feb 5, 2026
@danirabbit danirabbit moved this to Needs Review in OS 9 Feb 5, 2026
@leolost2605
Copy link
Member Author

leolost2605 commented Feb 7, 2026

@lenemter sure we can do that, I updated it.
Seems like something broke active shape correctly displaying (on fractional scaling?) but it's also on main and I'll open an issue for that #2756
Screenshot from 2026-02-07 13 45 52@1x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

Cannot select window by keyboard in multitasking view after workspace switching Pressing Esc doesn't close multitasking view

3 participants