FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
5.2k stars 82 forks source link

[Feature Request] Add event on space rearrange #563

Closed TheSkyentist closed 3 weeks ago

TheSkyentist commented 4 weeks ago

Would it be possible to add an event for when spaces are rearranged? E.g. when the spaces are manually moved in the Mission Control view (or potentially with a key-binding). Ideally this would pass the same info as the space_change event. With a little pointing in the right direction I could try to implement this, but I am not the most proficient with C or interacting with macOS.

Thanks!

FelixKratz commented 3 weeks ago

Sadly, when changing the spaces layout with the mouse via mission control, there is no event emitted which we could use to detect that.

If however you change the layout via a shortcut using e.g. yabai, you could of course simply trigger the space_change event manually in your hotkey handler along with the yabai command that actually moves the space. Something like

sketchybar --trigger space_change

Will forcefully emit the space change event for all spaces with the usual (and up-to-date)$INFO payload.