Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignoring launcher window #2397

Open
jbriales opened this issue Aug 19, 2024 · 1 comment
Open

Ignoring launcher window #2397

jbriales opened this issue Aug 19, 2024 · 1 comment

Comments

@jbriales
Copy link

jbriales commented Aug 19, 2024

(This may be out of scope but worth asking for any potential hints or tricks)

I'm trying to create a minimal launcher, similar to Spotlight or Alfred, that's written in Electron: https://gist.github.com/jbriales/c8b451973dfc2a60749b904f78a588f4

It seems those launcher windows are fully "transparent" to yabai (they don't get listed as windows at all), but the window created by Electron is listed:

Window query details

{
	"id":55513,
	"pid":25538,
	"app":"ylauncher",
	"title":"Launcher",
	"scratchpad":"",
	"frame":{
		"x":1080.0000,
		"y":650.0000,
		"w":400.0000,
		"h":300.0000
	},
	"role":"AXWindow",
	"subrole":"AXStandardWindow",
	"root-window":true,
	"display":1,
	"space":3,
	"level":0,
	"sub-level":0,
	"layer":"normal",
	"sub-layer":"normal",
	"opacity":1.0000,
	"split-type":"none",
	"split-child":"none",
	"stack-index":0,
	"can-move":true,
	"can-resize":false,
	"has-focus":true,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":true,
	"is-sticky":false,
	"is-grabbed":false
}

Is there any special setup in yabai so that those launcher windows get fully ignored? Or is it potentially sth missing on my launcher-app side?

This is important e.g. to avoid noisy signals about focus/front-app changes when opening this quick launcher.

@jbriales
Copy link
Author

jbriales commented Aug 21, 2024

Following up on this, I found there is a special type of window (hacked) in Electron to behave as similarly as possible to those "panel" apps like Spotlight or Alfred: electron/electron#34388

I dove a bit with debug_output on on what's happening on Yabai behind the scenes here for different "panel-like" windows and found some interesting stuff:

  • For Spotlight and Alfred, which behave seamlessly UI-wise, there is no event or message ever triggered within yabai's out.log
  • E.g. for ChatGPT, which has a panel-like window via shortcut, it is detected by yabai but it didn't trigger any window-related event (created or destroyed). This app however sometimes stops showing up when I invoke it via shortcut and I need to restart it. Not sure if that's related to yabai or not, but worth noticing it's not seamless.
  • For my Electron-based panel-like window, it's visually and behaviorally good, but it triggers (undesired) window-related events in yabai (logs below).
Example log for ChatGPT panel creation/destruction.

window_manager_create_and_add_window:61893 ChatGPT -  (AXWindow:AXSystemDialog:1)
window_manager_create_and_add_window ignoring incorrectly marked window ChatGPT 61893
window info: 
{
	"id":61893,
	"pid":5894,
	"app":"ChatGPT",
	"title":"",
	"scratchpad":"",
	"frame":{
		"x":1078.0000,
		"y":1328.0000,
		"w":404.0000,
		"h":48.0000
	},
	"role":"AXWindow",
	"subrole":"AXSystemDialog",
	"root-window":true,
	"display":1,
	"space":8,
	"level":3,
	"sub-level":0,
	"layer":"above",
	"sub-layer":"normal",
	"opacity":1.0000,
	"split-type":"none",
	"split-child":"none",
	"stack-index":0,
	"can-move":true,
	"can-resize":false,
	"has-focus":false,
	"has-shadow":true,
	"has-parent-zoom":false,
	"has-fullscreen-zoom":false,
	"has-ax-reference":true,
	"is-native-fullscreen":false,
	"is-visible":true,
	"is-minimized":false,
	"is-hidden":false,
	"is-floating":true,
	"is-sticky":true,
	"is-grabbed":false
}
EVENT_HANDLER_WINDOW_DESTROYED: ChatGPT 61893

Electron's panel-window logs

window_manager_create_and_add_window:104425 Electron - Launcher (AXWindow:AXStandardWindow:1)
event_signal_flush: transmitting window_created to 2 subscriber(s)
EVENT_HANDLER_MOUSE_DOWN: 1367.31, 1020.96
EVENT_HANDLER_MOUSE_UP: 1367.31, 1020.96
window_manager_create_and_add_window:104425 Electron - Launcher (AXWindow:AXStandardWindow:1)
EVENT_HANDLER_DAEMON_MESSAGE: query --windows scratchpad,is-visible,is-floating,id
EVENT_HANDLER_DAEMON_MESSAGE: query --windows id,pid,app,title,has-focus,stack-index,scratchpad,is-floating,is-visible,is-sticky --space
EVENT_HANDLER_WINDOW_DESTROYED: Electron 104425
event_signal_flush: transmitting window_destroyed to 2 subscriber(s)
EVENT_HANDLER_WINDOW_DESTROYED: Electron 104425

Window data for Electron's launcher window (looks like a completely normal window :/)

{
        "id":109120,
        "pid":29983,
        "app":"Electron",
        "title":"Launcher",
        "scratchpad":"",
        "frame":{
                "x":1080.0000,
                "y":542.0000,
                "w":400.0000,
                "h":300.0000
        },
        "role":"AXWindow",
        "subrole":"AXStandardWindow",
        "root-window":true,
        "display":1,
        "space":8,
        "level":3,
        "sub-level":0,
        "layer":"above",
        "sub-layer":"normal",
        "opacity":1.0000,
        "split-type":"none",
        "split-child":"none",
        "stack-index":0,
        "can-move":true,
        "can-resize":false,
        "has-focus":false,
        "has-shadow":true,
        "has-parent-zoom":false,
        "has-fullscreen-zoom":false,
        "has-ax-reference":true,
        "is-native-fullscreen":false,
        "is-visible":true,
        "is-minimized":false,
        "is-hidden":false,
        "is-floating":true,
        "is-sticky":true,
        "is-grabbed":false
}

Any ideas based on this on how to make the Electron's panel fully transparent to yabai?

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

No branches or pull requests

1 participant