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

Ephemeral Plugins #357

Closed
melonamin opened this issue Jan 11, 2023 · 5 comments
Closed

Ephemeral Plugins #357

melonamin opened this issue Jan 11, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@melonamin
Copy link
Contributor

Problem

Currently, SwiftBar is great at:

  • Adding permanent menu bar item
  • Dynamically adding and hiding a menu bar item using StealthMode

SwiftBar is not great at showing transient menubar items. A basic example: you launch a long shell process and want to have an indication(red or green circle) in the menu bar when it finishes. Currently, there is no easy way to do this.

Solution

Add Ephemeral plugins, so you can tell SwiftBar to show a menubar item without adding a plugin.

Key features:

  • can be created\updated\deleted through URL Scheme, Shortcuts and CLI(TBD if this is to much of a hustle)
  • Full support of SwiftBar plugin syntax
  • Can be removed from the menu bar using a special menu item specific to this type of plugin
  • all ephemeral plugins disappear on SwiftBar restart
  • ephemeral plugin can have a lifetime, i.e. self remove after 20 minutes
@melonamin melonamin added the enhancement New feature or request label Jan 11, 2023
@melonamin melonamin self-assigned this Jan 11, 2023
@melonamin melonamin pinned this issue Jan 11, 2023
@jasonsnell
Copy link

Love this idea. I think the key is going to be the ability for them to be unique, and addressable. So either the scripter would need to assign them a name, or SwiftBar would need to assign them an ID of some kind that's returned as output. That way, I can keep updating my status item as it moves through the process.

@jasonsnell
Copy link

So is there documentation somewhere on how to make an ephemeral plugin?

@melonamin
Copy link
Contributor Author

melonamin commented Sep 27, 2023

One of the reasons it is still in beta - I didn't have time to write the docs 😭

It is pretty easy to use, you have 3 parameters

  • name - this is the plugin name, should be unique
  • content - this is the markup you want SwiftBar to render
  • exitafter - this is optional parameter forces plugin to exit after a period of time, set in seconds.. Defaults to 0, which means don't exit :)

You can use it with URL scheme: swiftbar://setephemeralplugin?name=...content=... or thorugh new Shorctuts action "Set Ephemeral Plugin"

@melonamin
Copy link
Contributor Author

@jasonsnell have you had a chance to try it yet?

@jasonsnell
Copy link

Yep! Added it to my loooong transcription shortcut and it seems to have worked?

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

2 participants