Comments (8)
Implemented in #317. :)
from xbar.
I do like this idea. The ability for a script to just stay running and periodically send updated information to BitBar would really be a win, because it eliminates the overhead of spawning processes periodically, and it lets the plugin more easily maintain state across passes through its code (instead of having to stash its variables to a file every time it runs).
Also, I have noticed that even when I use "2> foo.txt" to redirect stderr, it instead changes the title of the plugin in the menu bar, rather than logging it to the file.
from xbar.
That's an interesting idea - so a single long running process. Hmmm.
from xbar.
... and thanks :)
from xbar.
It might sound bad in terms of a being a long running process, but it can make things quite efficient.
Sometimes there is an overheard with the first request, here websockets can be used to stream data down and update it as it arrives.
from xbar.
To spitball on a design for this: you could send a particular escape character to tell BitBar that this particular block of stdout has finished. Take for example the following script:
#!/usr/bin/env sh
COUNTER=0
count() {
COUNTER=$((COUNTER+1));
echo "$COUNTER"
echo '---'
echo "Some menu entry"
echo "~~~"
}
while true; do
count
sleep 1
done
The output looks a little like this:
1
---
Some menu entry
~~~
2
---
Some menu entry
~~~
3
---
Some menu entry
~~~
The ~~~
tells BitBar to take everything above it, and since the last ~~~
and render that menu. In other words BitBar can keep the process alive, buffer up to the next ~~~
and subsequently render the menu.
from xbar.
please merge this, I'm using this and it works, the ONLY issue I have is that somewhere is a memory leak, at least the way I'm using it, basically JavaScript/Deno connecting to a websocket, streaming data and console.log() updates in the BitBar format...over time Bitbar consumes several 100MB of memory (starting at around 5.5MB in my case), so I have to kill it and restart it every few days (it actually depends on how much data comes in). I suspect is some kind of issue with all the console.logs() accumulating in the background, I tried to console.clear() etc. with no success so far...
from xbar.
FWIW, the BitBar-alike SwiftBar uses this approach to do streaming plugins. See swiftbar/SwiftBar#118.
from xbar.
Related Issues (20)
- Suppress xbar Menu?
- How is the execution of the scripts?
- Crash on load (Sonoma) HOT 11
- auto change to 1 minutes
- Open plugin -> data: -> consumes a lot of processor power
- PyXbar, a python library for menubars that self installs!
- Support image URLs HOT 1
- Bash for loop is not working
- Bash code works on shell but not on Xbar. HOT 1
- Plugin can't call itself HOT 2
- Color of text is washed out if text is not clickable HOT 1
- Is it possible to make an action of main icon?
- Get "https://xbarapp.com/docs/plugins/categories.json": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) HOT 1
- Ellipsis ignores line break HOT 4
- The notation for escaping the pipe for non parameter string
- Refresh does not reflect config changes
- Get "https://xbarapp.com/docs/plugins/categories.json": dial tcp 104.21.77.62:443: connect: connection refused
- Get "https://xbarapp.com/docs/plugins/featured-plugins.json": dial tcp 172.67.204.220:443: connect: connection refused
- Get "https://xbarapp.com/docs/plugins/categories.json": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers) HOT 3
- Get "https://xbarapp.com/docs/plugins/featured-plugins.json": dial tcp 172.67.204.220:443: connect: connection refused HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xbar.