koekeishiya / yabai

A tiling window manager for macOS based on binary space partitioning
MIT License
23.92k stars 651 forks source link

Ignoring launcher window #2397

Open jbriales opened 2 months ago

jbriales commented 2 months ago

(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 commented 2 months ago

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: https://github.com/electron/electron/pull/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:

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?