Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add more query data types #1191

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Add more query data types #1191

wants to merge 3 commits into from

Conversation

xiamaz
Copy link

@xiamaz xiamaz commented Mar 7, 2025

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:

...
  {
    "app-name" : [
      "Mail",
      "iTerm2"
    ],
    "workspace-visible" : true,
    "workspace-focused" : true
  },
...

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant