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

Bar Integration #44

Closed
schneider-inc opened this issue Dec 7, 2023 · 9 comments
Closed

Bar Integration #44

schneider-inc opened this issue Dec 7, 2023 · 9 comments

Comments

@schneider-inc
Copy link

It would be useful for macOS ricers to be able to integrate Aerospace into macOS bars such as SketchyBar (in my case), so maybe a CLI command to get the current active workspace - and all workspaces for that matter?

@nikitabobko
Copy link
Owner

Duplicate of #16

@nikitabobko nikitabobko marked this as a duplicate of #16 Dec 7, 2023
@MatthiasGrandl
Copy link
Contributor

MatthiasGrandl commented Dec 30, 2023

I updated my sketchybar config based on the new (as of right now unreleased) list-workspaces command. Maybe this saves somebody a bit of work. it is limited by the event system. obviously space_change only applies to mission control spaces not aerospace workspaces, but for my usecase the front_app_switched works well enough. for some reason there is a small delay when changing spaces though, haven't debugged that yet.

sketchybarrc:

for sid in $(aerospace list-workspaces); do
  color="$INACTIVE"
  sketchybar --add item space.$sid left \
    --subscribe space.$sid front_app_switched \
    --subscribe space.$sid space_change \
    --set space.$sid \
    icon="􀀁" \
    background.drawing=off \
    label.drawing=off \
    icon.color="$color" \
    icon.font.size=12 \
    icon.align=center \
    padding_left=0 \
    padding_right=6 \
    click_script="aerospace workspace $sid" \
    script="$PLUGIN_DIR/aerospace.sh $sid"
done

plugins/aerospace.sh:

#!/usr/bin/env bash

SID=$1
FOCUSED=$(aerospace list-workspaces --focused)
bg="0xff585b70"
if [ "$SID" = "$FOCUSED" ]; then
  bg="0xffb4befe"
fi
sketchybar \
  --animate sin 10 \
  --set $NAME \
  icon.color="$bg"

my bar:

image

@nikitabobko
Copy link
Owner

nikitabobko commented Dec 30, 2023

BTW, it would be nice if someone could describe a basic setup with any of the existing bars (sketchybar, uebersicht) in AeroSpace Goodness page. The source code for the page is https:/nikitabobko/AeroSpace/blob/main/docs/goodness.adoc

I don't use bars, that's why I want someone else to do it

Just saying :)

@MatthiasGrandl
Copy link
Contributor

I can take care of that (for sketchybar). I’ll open a PR with a minimal setup, once the CLI is released.

@MatthiasGrandl
Copy link
Contributor

@nikitabobko Should I be able to get updates through the unix socket? For example workspace changes? Then I could implement a proper sketchybar event, which would be nicer than just polling for changes.

@nikitabobko
Copy link
Owner

nikitabobko commented Dec 30, 2023

@MatthiasGrandl please create an issue. It'd be nice to include the info on what would be the best format to integrate with sketchybar

I can see several ways on how it can be done:

  • TOML Config option (similar to on-window-detected) to register the callback on-workspace-changed = 'on-workspace-changed sketchybar update'
  • CLI command that adds a callback aerospace on-workspace-changed sketchybar update
  • CLI command that prints a new line each time a focused workspace changes: aerospace watch-workspace-changes
  • smth else

Note: sketchybar update is a placeholder. I don't know what command sketchybar uses

@MatthiasGrandl
Copy link
Contributor

@nikitabobko done, thank you #76

@MatthiasGrandl
Copy link
Contributor

BTW, it would be nice if someone could describe a basic setup with any of the existing bars (sketchybar, uebersicht) in AeroSpace Goodness page. The source code for the page is https:/nikitabobko/AeroSpace/blob/main/docs/goodness.adoc

I don't use bars, that's why I want someone else to do it

Just saying :)

Done #81 ! It depends on PR #80 to be merged and released.

@diogox
Copy link

diogox commented Aug 4, 2024

Unfortunately, from v0.14.0-Beta, the Displays have separate Spaces setting is recommended as disabled and Sketchybar will not start unless it's enabled.

Any other options out there?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants