Skip to content

fix(focus): don't suppress focus handling when the pointer hovers the dock and a window is focused - #110

Merged
oliwebd merged 1 commit into
oliwebd:mainfrom
victor402002:fix/focus-skip-dock-pointer
Oct 9, 2026
Merged

oliwebd merged 1 commit into
oliwebd:mainfrom
victor402002:fix/focus-skip-dock-pointer

Conversation

@victor402002

Copy link
Copy Markdown
Contributor

Problem

src/extension.ts:2698 skips the focus handler whenever Window.clutter_focus_is_shell_panel() returns true. That helper checks both the keyboard focus and the pointer hover position (window.ts::clutter_focus_is_shell_panel), and the dock/dash app icons match is_panel_actor() (they are overview-tile actors whose ancestor is the dash).

As a result, merely hovering the dock/panel makes O-Tiling skip its entire focus handling even when a real window just gained focus.

Measured with a temporary instrumented build (log-level 4, ~1 h): 132 skips, of which 21/22 happened while a real window was focused (brave-browser, Nautilus, Terminal…). Consequences: on_focused() is not called, so prev_focused, borders and the refocus/restore logic are not updated.

Full report + evidence: #108

Fix

Only skip when the shell truly holds focus (i.e. no real window is focused):

- if (Window.clutter_focus_is_shell_panel()) {
-     log.debug(`focus-window handler: shell-panel/dock actor detected — skipping`);
+ if (Window.clutter_focus_is_shell_panel() && !(global as any).display.get_focus_window()) {
+     log.debug(`focus-window handler: shell-panel/dock actor detected (no focused window) — skipping`);
      return;
  }

This keeps the intended protection (don't process while a panel popup/menu holds focus) but no longer suppresses handling of a legitimate window focus change.

Verification

With log-level=4, hovering the dock while switching windows (Alt+Tab):

  • Before: focus-window handler: shell-panel/dock actor detected — skipping fired repeatedly with a real window focused.
  • After: 16 focus changes → only 2 skips, both with get_focus_window = null (the new (no focused window) message). Zero skips with a real window focused.

Fixes #108.

@victor402002
victor402002 force-pushed the fix/focus-skip-dock-pointer branch from a3f2ea1 to 2d97c6c Compare October 6, 2026 15:14
@victor402002

Copy link
Copy Markdown
Contributor Author

Thanks! I ran the project's own checks on this branch to make sure the change is clean:

  • pnpm install --frozen-lockfile → OK
  • pnpm run type-check (tsc --noEmit) → exit 0
  • pnpm run lint (eslint src) → exit 0
  • pnpm run build → exit 0 (dist/extension.js generated; verified it contains the new condition)

Live behaviour (extension run with log-level=4, hovering the dock while switching windows with Alt+Tab):

  • Before: focus-window handler: shell-panel/dock actor detected — skipping fired repeatedly with a real window focused.
  • After: 16 focus changes → only 2 skips, both with get_focus_window = null (the new (no focused window) message); 0 skips with a real window focused.

Note: extension.js is not tracked in the repo (it is built into dist/), so the PR only touches src/extension.ts.

@oliwebd
oliwebd merged commit 03bf737 into oliwebd:main Oct 9, 2026
@victor402002
victor402002 deleted the fix/focus-skip-dock-pointer branch October 9, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Focus handling is skipped whenever the pointer hovers a dock/dash app icon

2 participants