Closed rwijtvliet closed 10 months ago
What do you mean by "displayed incorrectly", if you use the space component it should be displayed on the correct display with the appropriate mission control index.
If the problem is only due to the yabai label being lost, you could consider adding a sketchybar custom event, which you trigger with a yabai event (see: https://github.com/koekeishiya/yabai/blob/master/doc/yabai.asciidoc#signal): i.e.
sketchybar --add event display_count_change
yabai -m signal --add event=display_added action="sketchybar --trigger display_count_change"
yabai -m signal --add event=display_removed action="sketchybar --trigger display_count_change"
now you can subscribe your items to the display_count_change
event and handle the yabai label problems.
Apart from all of this we could indeed easily expose a native event for display_configuration_change
, which is triggered when a display is connected/disconnected/moved/resized etc, with the current display configuration i.e. index, width, height, position etc. as a $INFO
payload. All of these system events are already handled internally to properly update the bar.
I use the label of the space as its icon on the bar, and when this label gets reset to the emptystring (see the discussion here), I see an empty box where I expect a helpful label. It also happens on system wake, but that one I can catch and handle directly in sketchybar.
I think your workaround should indeed work; thanks for pointing out that yabai has additional events. I'll give it a try, chaining the events as you suggested.
Regardless, having it directly available in sketchybar would be a helpful addition imo.
I will close this as not planned currently because I will probably not work on this event myself. Feel free to post a PR though.
When connecting my machine to an external display, the spaces are distributed to occupy both spaces. In the process, the first space on the secondary display loses its yabai label (a macos issue, apparently), causing it to be displayed incorrectly on my sketchy bar.
An workaround would be, if I could subscribe my sketchybar items to an event which is triggered when a display is connected or disconnected.