koekeishiya / yabai

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

Live signals #1606

Open koekeishiya opened 1 year ago

koekeishiya commented 1 year ago

Just some thoughts..

The signal system currently works by executing an external command, which of course requires a fork -> exec chain, resulting in spawning a new process. This works reasonably well from a scripting point of view, but it is quite bad for writing standalone (long running) tools that integrates nicely with yabai. This is because yabai acts as a client invoking a command; to enable inter process communication, the tool integrating with yabai would need to run a server on its own (or have some way to be invoked) to consume the information.

When a signal is registered it should be possible to specify a communication type/kind/class: exec, fifo, socket. If fifo/socket is selected data would be passed as json equivalent to the ouput of the query system for that entity, instead of setting an id in an environment variable (as is done for the exec type -- the way signals work now).

A system like this would need to be structured differently from the current signal system. It should be possible to listen for multiple event types without having to require one fifo/socket for every event/signal that is registered, assuming they are all reported to the same client. The client would differentiate by type in its message handler, and handle each event as appropriate.

sebb3 commented 4 months ago

This would be a great feature!

koekeishiya commented 3 months ago

Will likely only add tcp connection, not fifo. Not sure when I'll do this, but I am working on (or plan to anyway) a project where I need (read: want) this functionality myself as well; https://github.com/koekeishiya/meraki/issues/1#issuecomment-1994003227.

MarcWeber commented 1 day ago

https://github.com/MarcWeber/ubersicht-yabai-spaces This is an example why websockets would be one nice implementation. yabai --verbose | node node yabai-to-websocket.mjs, symlink dir to uebersicht ..

The problem is how do I focus uebersicht ? I tried query windows, but didn't find the uebersicht widget. I want to achive an action move or goto space X where X is asked for tab completing existing spaces and allowing a new name to be entered.