Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently querying aerospace is rather slow (approx 50ms per call on my machine). I believe this is mostly caused by the usage of unix domain sockets for IPC, which seems to be much slower than mach ports, which is used by sketchybar (approx 1ms per call).
A common use-case, where this is noticeable is for updating bars and there has been some complex workarounds. Most of these can be removed by just creating a single call that contains all necessary information.
This modification allows us to get a list of workspaces including visibility and focus information, as well as names of apps. This is composable, so now e.g. window and app variables can also be used for workspace queries.
This can e.g. be used in the following command:
./.debug/aerospace list-workspaces --all --format '%{workspace-focused}%{workspace-visible}%{app-name}' --json
Which will return e.g. the following json response now:
This allows for statusbar updates without noticeable latency without any additional caching or variables.
@nikitabobko Please let me know if you are interested in potentially merging this. I can make this a bit more complete and add some testing and documentation.
Related issues:
#104
These changes are used in the following sketchybar plugin: https://github.com/xiamaz/sketchybar-aerospace-plugin