Skip to content

feat(focus): focus a window as soon as it opens - #186

Merged
LeVraiArdox merged 2 commits into
AxOS-project:mainfrom
shinigami-os:Focus-on-app-open
Nov 15, 2026
Merged

LeVraiArdox merged 2 commits into
AxOS-project:mainfrom
shinigami-os:Focus-on-app-open

Conversation

@OxoGhost01

Copy link
Copy Markdown
Contributor

Problem

With follow_mouse = 1, a newly opened window does not get focus until the mouse moves. If you open an app (launcher, dock, keybind) and leave the cursor where it is, focus stays on the window under the cursor.

Change

  • New FocusOnOpen service: listens for Hyprland's openwindow event and focuses the new window.
  • It skips windows with no class (menus, tooltips), windows opened on a workspace that is not in front (autostart and background apps), and anything opened while the screen is locked.
  • New option interactions.focusOnOpen (default true) to turn it off.
  • The service is loaded from shell.qml.

Testing

Tried on a Hyprland session: with a window already open under the cursor, opening a second one focuses it without touching the mouse. Not tested with special workspaces (scratchpad).

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Issues

1. Invalid Hyprland dispatcher call (FocusOnOpen.qml)

Hyprland.dispatch(`hl.dsp.focus({ window = "address:0x${address}" })`);

Where did hl.dsp.focus come from? Hyprland is not a Lua runtime. Hyprland's IPC dispatcher for focusing a window is focuswindow.

Furthermore, Quickshell's Hyprland.dispatch() method takes (dispatcher, args). Passing a single synthetic command string will cause Hyprland's socket parser to treat the whole string as the dispatcher name and fail.

Change it to:

Hyprland.dispatch("focuswindow", `address:0x${address}`);

@LeVraiArdox

Copy link
Copy Markdown
Member

Hyprland is not a Lua runtime.

Is it bozo

@OxoGhost01

Copy link
Copy Markdown
Contributor Author

let him learn he's still a beginner after all 🤣

@LeVraiArdox LeVraiArdox left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM. I should train that AI with vaxry's bible

@LeVraiArdox
LeVraiArdox merged commit f96080d into AxOS-project:main Nov 15, 2026
3 checks passed
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.

2 participants