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

ER: Support for multiple bars #353

Closed
peterhajas opened this issue Apr 5, 2023 · 4 comments
Closed

ER: Support for multiple bars #353

peterhajas opened this issue Apr 5, 2023 · 4 comments
Labels

Comments

@peterhajas
Copy link

I didn't find a prior issue or documentation about this.

It'd be great if Sketchybar supported multiple named bars. For example:

  • A separately configured bar for each external display, with custom items
  • A custom top / bottom bar for a display (or left/right, using the undocumented other bar positions)
  • Two bars stacked on top of each other

This could likely be extended to the current syntax by naming the bar (where the default is --bar). For example:

sketchybar --bar=secondary set color=...
sketchybar --bar=tertiary --add item asdf ...
@FelixKratz
Copy link
Owner

FelixKratz commented Apr 5, 2023

I think it is definitely possible to do this within the scope of this project. From the technical aspect this is some work, but the difficulty is fairly easy. The hard part is to work out a syntax that is easy and intuitive to use.
There would be the need to add a new bar on a specific display and a way to prefix commands that target this bar.

Once I have time to rework the popup system (which will bring most of the refactoring needed for this feature as well) I will think about this some more. If there are ideas for a full syntax (adding bars, removing bars, targeting bars) let me know.

The hackiest way to achieve this today is to have two or more distinct sketchybar binaries (with different binary names, bootstrap names, lock-files and sketchybarrc files) that operate completely independent of each other.

Another way to achieve this today is with popups, but it is not as flexible.

@FelixKratz FelixKratz added the enhancement New feature or request label Apr 5, 2023
@FelixKratz
Copy link
Owner

FelixKratz commented Apr 5, 2023

Ok, so I have pondered with this idea for the last half an hour and have come up with something that is actually quite usable I think (ff96bd7). The binary name of sketchybar can now be used as an identifier for multiple bars. I.e. if you install from HEAD (brew install sketchybar --head) you can:

ln -s /opt/homebrew/bin/sketchybar /opt/homebrew/bin/bottom_bar

and then run bottom_bar in your commandline. It will launch an additional bar which is targeted with bottom_bar --bar ... and has its config in ~/.config/bottom_bar/sketchybarrc. This is only an example but since the bars are entirely independent of each other it is possible to create as many bars as you like simply by symlinking as many bar instances as you like.

@peterhajas
Copy link
Author

Thanks, @FelixKratz. This looks like a good way to explore multiple bars.

After copying my config and renaming the names of all my existing sketchybar invocations, I can now have two bars. Cool!

For syntax, I wonder if leaning on the existing --add semantics could work. So:

# add a bar
sketchybar --add bar my_bar

# change properties
sketchybar --bar my_bar set color=...

# add an item
sketchybar --bar my_bar --add item asdf

One thing that's missing with this approach (or the symlinked copy of sketchybar) is assigning a bar to a particular display. Happy to file another issue if you'd rather track that separately.

@FelixKratz
Copy link
Owner

Lets track the display options separately, it shouldnt be a problem to add more powerful display selectors.

johnallen3d added a commit to johnallen3d/sketchybar-rs that referenced this issue Jan 6, 2024
SketchyBar allows for multiple bar by symlinking to `sketchybar` and
running a second process (eg. `bottombar`). In order for the helper to
find the `mach` port for the targeted bar we need to provide the bar
processes name.

FelixKratz/SketchyBar#353 (comment)
FelixKratz/SketchyBarHelper#2
johnallen3d added a commit to johnallen3d/sketchybar-rs that referenced this issue Jan 6, 2024
SketchyBar allows for multiple bar by symlinking to `sketchybar` and
running a second process (eg. `bottombar`). In order for the helper to
find the `mach` port for the targeted bar we need to provide the bar
processes name.

FelixKratz/SketchyBar#353 (comment)
FelixKratz/SketchyBarHelper#2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants