I'm currently using a Uebersicht bar (a clean roomed React version of pecan), and for instant update of the desktop number I've set the refresh rate at 500ms (which literally drains my MacBook's battery - Uebersicht's battery use is the highest of all apps in my MacBook :-().
I was very interested in the yabai's new bar, as the bar can only update itself when needed; which can considerably lower battery use. I would like the bar be configurable or such; but I can't even imagine how it can be. 馃槥
What about exposing the event callback that the bar uses to refresh?虋虉 (I'm not sure how exposing can be available...)
I was thinking about this for about an hour, and it looks like it would be dependent heavily on how the bar is implemented.
Do you have any opinions or plans about configuring the bar?
The current bar is very basic and is not really built with extension in mind. There is a single function that renders information in the bar - that's it. I haven't really given this problem a lot of thought and I don't have a lot of experience with graphics either.
The bar itself is isolated from the rest of the codebase and consists of less than 300 lines of C code - so it should be easy enough for anyone that is familiar with rendering to modify the bar in their own fork to have it look differently.
Simply exposing the event callback that refreshes the bar won't help here. There needs to be some facility that lets the user build the bar. This could be by simply being able to have a format string to select already-built functionality - lets call these "blocks". This would require me to implement some sort of a module system. The user could select which blocks to use, a long with some formatting information to specify font, color, alignment and so on for each block.
With 脺bersicht this is actually quite simple, all you need to do is set the refreshFrequency to false and run osascript -e 'tell application "脺bersicht" to refresh widget id "my-widget"' whenever you want it to be refreshed.
I think this would be solved better with yabai commands similar to rules that allow you to invoke any shell command whenever the active window/space/display changes.
Something like this, with a syntax that's similar to rules and easy to extend with more options:
yabai -m notification trigger=space-changed \
action="osascript -e 'tell application \"脺bersicht\" to refresh widget id \"yabai-space-widget\"'"
I think this would be solved better with yabai commands similar to rules that allow you to invoke any shell command whenever the active window/space/display changes.
That may be a sufficient solution for most users and seem fairly trivial to do. I assume these notifications are simply signals and don't actually propagate data - the widget will still have to utilize the query commands to retrieve information.
This bar implementation was mostly something I implemented for my own use because 脺bersicht randomly stopped working without me having made any changes to my configuration. In addition the widget I used to have usually used quite a bit of cpu, drained battery and actually made my fans spin.
These are mostly because of constructing a poor solution due to lack of knowledge in that field -
I finally got fed up and wanted to step into an environment where I'm more comfortable and experienced - aka C.
I assume these notifications are simply signals and don't actually propagate data
Yes. But you can of course split your widget into multiple smaller widgets to gain more fine鈥揼rained control.
(Edited for clarification)
due to lack of knowledge in that field
Honestly, as long as you don't use refreshFrequency with 脺bersicht it's completely fine. No issues whatsoever.
I've been meaning to create a native NSStatusBar app around chunkwm (or now yabai) for a while, but the issue with those is that there's no way to configure them for multiple displays because macOS renders the items only once and then copies them over to all other displays. That would be the perfect solution for a single display imo: Show one NSStatusBarItem for every space on the active display.
Implemented support for signals. See the appropriate section of the documentation.
The following sample displays a notification using applescript when the active space changes:
yabai -m signal --add event=space_changed action="osascript -e 'display notification \"active space changed.\" with title \"yabai\" subtitle \"signal\"'"
It is possible to add multiple signals for the same event, and they will be processed asynchronously in a FIFO fashion. Signals themselves are also executed asynchronously and will not block yabai.
I don't plan on making the built-in bar more customizable for the time being, and it is off by default.
Closing this.
Most helpful comment
Implemented support for signals. See the appropriate section of the documentation.
The following sample displays a notification using applescript when the active space changes:
It is possible to add multiple signals for the same event, and they will be processed asynchronously in a FIFO fashion. Signals themselves are also executed asynchronously and will not block yabai.
I don't plan on making the built-in bar more customizable for the time being, and it is off by default.
Closing this.