yabai icon indicating copy to clipboard operation
yabai copied to clipboard

More Spaces Signals

Open ispringle opened this issue 2 years ago • 1 comments

It'd be great if there were some more signals related to Spaces, ideally a signal for each action that Yabai can do to a space (ie Create, Delete, Move, etc.). There is one already:

space_changed
Triggered when the active space has changed.
Passes two arguments: $YABAI_SPACE_ID, $YABAI_RECENT_SPACE_ID

It'd be great if there were additionally:

space_created
Triggered when a space has beed created.
Passes two arguments: $YABAI_NEW_SPACE_ID, $YABAI_CURRENT_SPACE_ID
space_deleted
Triggered when a space has been deleted.
Passes two arguments: $YABAI_DELETED_SPACE_ID, $YABAI_NEXT_SPACE_ID
space_moved
Passes two arguments: $YABAI_SPACE_ID, $YABAI_DISPLAY_ID

ispringle avatar Aug 18 '22 17:08 ispringle

Another option is that we can customize/create new ones, but please 🙏🏻 take a look on this issue

GOI17 avatar Sep 14 '22 19:09 GOI17

I'd love this as well: signals for space created and destroyed would be very useful for triggering updates of status bars/widgets. Depending on how ids change when a space is created/destroyed, it could make sense to pass the uuid, or maybe to have just a generic "space count updated" signal that passes no args could do double-duty for both create and destroy: the handler could query the spaces and decide what to do. AFAICT there is no way to listen for these events currently.

Additionally, a signal for space label changed would allow for some interesting workflows as well.

prurph avatar Oct 08 '22 21:10 prurph

space_created and space_destroyed added on master (Ventura only for now as we depend on a system event that I'm not sure exists in earlier versions). Unable to test/look for space_moved as I only have a single monitor available for now.

https://github.com/koekeishiya/yabai/commit/a51af04ccaac1dbef412d4b1069e49bc9f2df816

koekeishiya avatar Aug 12 '23 15:08 koekeishiya