Skip to content

Pointer and keyboard focus are not the same #363

@anriha

Description

@anriha

I've been working on implementing a proper sloppy focus policy in my config and have run into a limitation with the current focus model. I wanted to open this issue to discuss a potential architectural improvement.

The Problem

The current example for sloppy focus works for basic cases, but fails in a common scenario:

  1. Keyboard focus is on Window A.
  2. The user switches keyboard focus to Window B without moving the pointer (via key bindings/layout change).
  3. The user then moves the pointer over Window A.

In this case, focus remains incorrectly on Window B. The root cause is that the PointerEnter signal only fires when the pointer focus changes (i.e., when crossing a surface boundary), but it doesn't take the compositor's actual keyboard focus into account.

Attempted Solution

My first thought was to patch the signal logic to be aware of keyboard focus. I've implemented that here: a09c56b

While this commit does make sloppy focus work as expected, it feels like the wrong approach. It changes the fundamental meaning of the PointerEnter signal, which could have unintended side effects for other use cases or for users who prefer click-to-focus.

Proposed Architectural Solution

Instead of patching the signals, I believe a better, more robust solution would be to unify the pointer and keyboard focus models at the compositor's core.

This would make sloppy focus a built-in, reliable behavior, and the PointerEnter/Leave signals could return to their simple, pure meaning of boundary crossings.

I'm happy to work on a PR to implement this unified model if you agree that this is a sensible direction for the project. Looking forward to your thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions