Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[v3][Linux] detectFocusFollowsMouse() misses niri compositor, causing HideOnFocusLost popups to immediately dismiss

Open Beginner friendly
#6,517 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@1steve78 is already working on this.

Since Oct 30, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, linux
Domain
backend, desktop

Research direction

Read pkg/application/environment_linux.go, especially detectCompositor() and detectFocusFollowsMouse(). Check how the existing compositor environment variables are detected, then add niri detection as described in the issue. Done means niri is recognized and focus-follows-mouse detection returns true for it, so HideOnFocusLost is skipped.

Written by the indexing model from the issue text.

Description

Wails version family

v3

Exact Wails version

v3.0.0-beta.24 (and master)

Operating System

Linux

Description

In Wails v3, WebviewWindowOptions.HideOnFocusLost is intended for popup / systray attached windows. As documented in pkg/application/webview_window_options.go (line 240):

"On Linux with focus-follows-mouse WMs (Hyprland, Sway, i3), this is automatically disabled as it would cause the window to hide immediately when the mouse moves away."

To achieve this, setupHideOnFocusLost() checks shouldSkipHideOnFocusLost() which calls detectFocusFollowsMouse() in pkg/application/environment_linux.go:

func detectFocusFollowsMouse() bool {
	compositor := detectCompositor()
	switch compositor {
	case "hyprland", "sway", "i3":
		return true
	}
	return false
}

However, detectFocusFollowsMouse() only matches hyprland, sway, and i3. It misses niri (a scrollable tiling Wayland compositor where focus-follows-mouse is widely used).

Under niri with focus-follows-mouse enabled:

  1. User clicks a StatusNotifierItem tray icon located on a top bar (e.g. Noctalia or Waybar) at $(x, 15)$.
  2. The Wails systray attached window / popup opens below the bar (e.g. at $(x, 40)$).
  3. The pointer remains on the bar surface at $(x, 15)$, outside the popup's visual geometry.
  4. Any pointer release, sub-pixel jitter, or initial movement triggers niri's focus-follows-mouse, switching focus to the underlying tiled window.
  5. GTK receives focus-out-event (events.Common.WindowLostFocus), and Wails immediately hides the popup window within ~50ms.
  6. The window appears and vanishes instantly.
To Reproduce
  1. Run a Wails v3 app with a systray attached window configured with HideOnFocusLost: true on Linux under niri.
  2. Enable focus-follows-mouse in niri (~/.config/niri/config.kdl):
    input {
        focus-follows-mouse
    }
    
  3. Click the tray icon on a top/bottom status bar.
  4. The attached popup window appears and disappears almost instantaneously upon pointer release/slight motion.
Expected behaviour

detectFocusFollowsMouse() should identify niri as a tiling compositor with focus-follows-mouse capability, disabling HideOnFocusLost so the popup remains interactive until explicitly closed or dismissed.

Screenshots

No response

Attempted Fixes
  • Adding open-floating true in niri window rules avoids tiling animations, but focus-follows-mouse still causes immediate dismissal when the cursor is on the bar.
  • Disabling focus-follows-mouse in ~/.config/niri/config.kdl or configuring warp-mouse-to-focus mode="center-xy" prevents the focus loss, confirming that HideOnFocusLost receiving premature focus loss is the direct trigger.
System Details
OS: CachyOS Linux (Arch Linux rolling)
Kernel: 7.3.0-rc6-2-cachyos-rc
Architecture: x86_64
Compositor: niri 26.04 (Wayland)
Go Version: go1.26.4 linux/amd64
Wails Module: github.com/wailsapp/wails/v3 v3.0.0-beta.24
Additional context

Suggested Fix:
In pkg/application/environment_linux.go:

  1. Add NIRI_SOCKET check to detectCompositor():
 func detectCompositor() string {
 	if os.Getenv("HYPRLAND_INSTANCE_SIGNATURE") != "" {
 		return "hyprland"
 	}
 	if os.Getenv("SWAYSOCK") != "" {
 		return "sway"
 	}
 	if os.Getenv("I3SOCK") != "" {
 		return "i3"
 	}
+	if os.Getenv("NIRI_SOCKET") != "" {
+		return "niri"
+	}
 	if desktop := os.Getenv("XDG_CURRENT_DESKTOP"); desktop != "" {
 		return strings.ToLower(desktop)
 	}
 	return "unknown"
 }
  1. Add "niri" to detectFocusFollowsMouse():
 func detectFocusFollowsMouse() bool {
 	compositor := detectCompositor()
 	switch compositor {
-	case "hyprland", "sway", "i3":
+	case "hyprland", "sway", "i3", "niri":
 		return true
 	}
 	return false
 }
Dominant language
Go
Stars
36.9k
Forks
1.9k
Avg merge
21h 41m
Merged PRs (30d)
181

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wailsapp/wails

All issues in wailsapp/wails

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.