Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Aerospace WM support #423

Open
AnirudhG07 opened this issue Nov 14, 2024 · 21 comments
Open

Aerospace WM support #423

AnirudhG07 opened this issue Nov 14, 2024 · 21 comments
Labels
enhancement New feature or request

Comments

@AnirudhG07
Copy link

Is your feature request related to a problem? Please describe.
I really like the looks of Simple-bar, but as the repo says, its for yabai. So Does it work for Aerospace WM for Mac???

Describe the solution you'd like
If it doesn't work for aerospace, is there anyway I can use simple-bar?

Describe alternatives you've considered
NA

Additional context
I searched for any issues related to it, coudnt find.

@AnirudhG07 AnirudhG07 added the enhancement New feature or request label Nov 14, 2024
@Jean-Tinland
Copy link
Owner

Hi, sorry for my late response!

Unfortunately, simple-bar is working only with yabai, as it depends on its signals and command line interface for spaces and application display.

I'm not planning to adapt simple-bar to Aeorspace for now but if this request get sufficient traction, I could take a deeper look on the feasibility :)

@Jean-Tinland Jean-Tinland added the question Further information is requested label Nov 25, 2024
@AnirudhG07
Copy link
Author

Thanks! It would be much appreciated to get Aerospace with simple-bar! And I think people will also like it.

@Zik42
Copy link

Zik42 commented Dec 17, 2024

+1 to this feature

@Jean-Tinland Jean-Tinland changed the title Does Simple-bar work for Aerospace WM? Aerospace WM support Dec 31, 2024
@Jean-Tinland Jean-Tinland pinned this issue Dec 31, 2024
@Jean-Tinland
Copy link
Owner

Jean-Tinland commented Dec 31, 2024

From now on, AeroSpace is supported! It lacks some features compared to the yabai implementation but it is completely usable.

You can enable it in settings (cmd + , after clicking on simple-bar in an empty space) > "Global" tab > "Which window manager ?"
AeroSpace path can also be modified in this same settings tab.

I will keep this issue opened and pin it so anyone can leave feedback and feature requests!

Edit: typo and more details

@Jean-Tinland Jean-Tinland removed the question Further information is requested label Dec 31, 2024
@AnirudhG07
Copy link
Author

Lessgooo!

@AnirudhG07
Copy link
Author

AnirudhG07 commented Jan 1, 2025

hi @Jean-Tinland, if I press alt(option) + 1 to shift to 1 workspace, the workspace number of simple-bar doesnt change.

31521

How to fix this? As you can see right now I am in 2, with safari yet the 3rd one is highlighted.

nvm fixed. I put the mentioned aerospace edits the wrong place there, so didnt work.
Also, I m really loving simple-bar! thanks so much!

@Jean-Tinland
Copy link
Owner

Glad to hear everything works fine now and happy to hear you like simple-bar! :)

@AnirudhG07
Copy link
Author

I have a few questions I tried to looked into the docs(might have skipped)

  1. Can the delay time of highlight in the bar when switching from workspace X to Y be reduced? when I switch, I see this 1/2-1 second delay bw the bar to load with new workspace info.
  2. Can we move around the widget locations? Pls refer to the docs link if its present(sorry if I missed it)

@Jean-Tinland
Copy link
Owner

Jean-Tinland commented Jan 1, 2025

There is indeed a slight delay when switching spaces.

It is mainly due to how Übersicht works: it can only be refreshed with the help of applescript (osascript -e ...). This process takes less or more time depending on your hardware. It is clearly not optimal for a widget like simple-bar that requires quick and repeated refreshes.

In order to circumvent that, I created simple-bar-server. This little node server is allowing to bypass Übersicht and communicate directly with all simple-bar's widgets with web sockets. It is a lot faster for the yabai implementation but it requires to install another tool so not everyone will be on board with this approach.

I'm planning to add the AeroSpace implementation in simple-bar-server soon! I'll let you know when everything is ready.

Using this basically allow you to refresh any simple-bar widget with simple curl.

About you second question, you can enable the "Bottom bar" setting in the "Global" tab.
If you need to change the data (right) widgets order, you can do it with the "Custom styles" tab and assign a new CSS order to each data widget.

For example:

.weather {
  order: 2;
}

.battery {
  order: 1;
}

Let me know if this helps you.

Edit: typos

@nikitabobko
Copy link

nikitabobko commented Jan 2, 2025

I don't know about simple-bar-server and Übersicht specific problems, but I'd like to notice that AeroSpace itself can be the cause of the delay.

The problem here is that AeroSpace is a single threaded application, and macOS AX API is blocking API, so when you switch workspaces, AeroSpace thread is blocked by macOS, and the thread doesn't have resources to answer the CLI query like aerospace list-workspaces.

I plan to address such performance problems in nikitabobko/AeroSpace#104 nikitabobko/AeroSpace#131

Currently, the workaround is to use AEROSPACE_FOCUSED_WORKSPACE environment variable (as we do it in integration with sketchybar https://nikitabobko.github.io/AeroSpace/goodies#show-aerospace-workspaces-in-sketchybar also mentioned in the docs) and avoid 1 unnecessary aerospace list-workspaces query request.

I see that 5852a58 doesn't use AEROSPACE_FOCUSED_WORKSPACE, so the delay may not be completely eliminated, even after "simple-bar-server fix"

@Jean-Tinland
Copy link
Owner

@nikitabobko I see! Thank you for all theses details!
Unfortunately, it is not possible to pass arguments to Übersicht when asking it to refresh a specific widget.

I won't be able to improve the default implementation but when I'll work on simple-bar-server integration of AeroSpace, the use of the AEROSPACE_FOCUSED_WORKSPACE environment variable will be possible. Thank you again for this :)

@AnirudhG07
Copy link
Author

Hi, is there a way to only show those workspaces on top which have some soft open? else it just disappears. Since aerospace has like multiple empty workspaces as well, and all of them just shows up at the top, even if empty, doesnt look neat.

@Jean-Tinland
Copy link
Owner

Sure, there is a "Hide empty spaces" setting in the "Spaces" tab in the settings.

@AnirudhG07
Copy link
Author

Great! I think just like you have yabai based sections in docs, maybe you should have 1 for aerospace addressing these issues + Some nice Tips which aerospace users might benefit from! If you would like

@AnirudhG07
Copy link
Author

Ques. I have toggled empty spaces to not be visible. But in aerospace I have many such spaces. This also disables if I am in an empty workspace. Say I am in 1, but thats empty. then simple-bar doesnt show that I am in 1.
Is there anyway to enable it?

@Jean-Tinland
Copy link
Owner

That was a bug! Thank you for reporting it. It should be fixed in my latest commit.

@AnirudhG07
Copy link
Author

Thanks! It works perfectly

@hld0
Copy link

hld0 commented Jan 13, 2025

Hi guys! First of all big thank you to Jean, I have been using simple-bar for so long that I don't even know how to go back to the old menu bar.

I recently made the switch from yabai to aerospace too, and played around with the config a bit. Today realized something that I don't know how to classify - I don't know if it is a bug or just an oversight of me somewhere in the config. But maybe it will help somebody facing this problem too:

My usual working setup includes two monitors (one Dell, one LG) with my MacBook lid being closed. Therefore, I used the following assignment in the .aerospace.toml (I am not using spaces 1 and 2 as it clashes with other shortcuts otherwise)

 [workspace-to-monitor-force-assignment]
    3 = ["dell", "main"]
    4 = ["dell", "main"]
    5 = ["dell", "main"]
    6 = ["LG", "main"]
    7 = ["LG", "main"]
    8 = ["LG", "main"]
    9 = ["LG", "main"]

Now what happened was, that simple-bar showed the spaces 3,4,5 on the LG monitor and the spaces 6,7,8,9 on the Dell monitor. However, clicking on a space in the bar correctly switched the focus to the other monitor (e.g. I click on space 6 which is shown in the Dell monitor, the cursor correctly jumps to the LG monitor).

What fixed this for me was moving the menu bar in the display arrangement settings (Settings -> Displays -> Arrange...) from one screen to the other. You can click and drag the gray menu bar shown in one of the displays around:

image

Now the spaces are shown correctly in the simple bar too. Is this expected behavior?

@Jean-Tinland
Copy link
Owner

Jean-Tinland commented Jan 15, 2025

Hi @hld0! Thank you for your kind words, I really appreciate that you love using simple-bar! :)

Thanks for explaining your configuration, I think this is due to a monitor number mismatch between simple-bar and AeroSpace. Because of this, simple-bar is displaying the workspaces on the wrong monitor.

I don't know the rules for the monitor/id association thus I can't explain what is going on. I had indeed some problems while integrating this so I settled on using monitor-appkit-nsscreen-screens-id for AeroSpace workspaces numbering.

AeroSpace documentation excerpt:

%{monitor-id}
1-based Number. Sequential number of the belonging monitor

%{monitor-appkit-nsscreen-screens-id}
1-based index of the belonging monitor in NSScreen.screens array. Useful for integration with other tools that might be using NSScreen.screens ordering (like sketchybar).

In my tests, I saw that these values were not the same depending mainly on the displays arrangement in Macos settings.

I could add a setting in simple-bar allowing to choose which value to use (monitor-id or monitor-appkit-nsscreen-screens-id). Maybe it would solve your issue but it would require you to test it.

As a last resort, your solution seems to work well even if it was not intended on my side.

Please let me know if you want me to implement this. If so, I'll also add an entry in documentation explaining the issue.

@haxybaxy
Copy link
Contributor

Hello,

Image

Sorry for bothering but I am having trouble with getting simplebar to start with aerospace.
I get the error:

simple-bar-index.jsx: aerospace is not running

Nothing is logged to the debug console, I used to get a

[Error] XMLHttpRequest cannot load http://127.0.0.1:41416/run/ due to access control checks.

but It went away once I turned off the browser track widget

I am sure that aerospace is in fact running, restarting it, and doing aerospace enable off and aerospace enable on does not solve the issue.

I tried installing ubersicht from the website and brew, no change in the behaviour.

when I run which aerospace I get this path:

/opt/homebrew/bin/aerospace

which is the default path indicated in the settings module.

I also have the code snippet added to my aerospace.toml

on-focus-changed = [
  "exec-and-forget osascript -e 'tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\"'",
]

exec-on-workspace-change = [
  '/bin/zsh',
  '-c',
  '/usr/bin/osascript -e "tell application id \"tracesOf.Uebersicht\" to refresh widget id \"simple-bar-index-jsx\""',
]

I am on ubersicht 1.6 and MacOS Sequoia 15.1.1
Is there something I am missing? I would love to get this working
Thank you

@Jean-Tinland
Copy link
Owner

Hi! Can you check if you are using the latest version of AeroSpace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants