xbar icon indicating copy to clipboard operation
xbar copied to clipboard

Feature request - multiple lines in menu bar

Open nguyenhung opened this issue 3 years ago • 7 comments

Is it possible to display 2 or more lines of text in menu bar? Use case:

  • Weather: City(normal text in one line) - High temperature/ Low temperature (two lines)
  • Stock Quote: Ticker(normal text in one line) - Bid Ask price (two lines)
  • Network monitoring: Up/Down(two lines)

Turn this Screen Shot 2021-03-09 at 12 21 51 AM

into this: Screen Shot 2021-03-09 at 12

nguyenhung avatar Mar 09 '21 05:03 nguyenhung

Mat would be able to explain it better, but right now this would require a non-negligible change to xbar, since there's already a convention for how to handle multi-line output from a plugin, to create the text that populates the drop-down portion for a displayed plugin. The output would need to be rendered differently, too, since right now it's just writing text to the menu bar, and stacking lines of text in the menu would probably require rendering the text as a small image and placing this into the menu bar, rather than just using text.

I could see how this would be useful. This isn't a comment on whether it's likely to be a feature that gets added; I'm mostly just thinking aloud about what would be required to make that happen.

ianfoo avatar Mar 09 '21 05:03 ianfoo

+1 I would really like to be able to do this also.

johnoscott avatar Mar 09 '21 06:03 johnoscott

Is the idea behind this that EG: "one|two|three" would be output on 3 distinct items (if we chose | as the split character) or 1 item that is 3 lines tall?

leaanthony avatar Apr 20 '21 21:04 leaanthony

+1 for this, my bar is getting too crowded, this would be an amazing feature.

jrejaud avatar May 25 '21 02:05 jrejaud

This would indeed be quite a wonderful addition. Just found this plugin and love iStat Menus way of displaying some information stacked. Not sure how it is done though — the idea with the rendered image could be close.

chrisspiegl avatar Nov 10 '21 08:11 chrisspiegl

I actually was able to achieve something similar myself inside my script.

It's based on node-canvas and performs a speedtest so I know how fast my connection is at the moment.

Essentially an image is created and rendered to base64 which is then displayed in the menu bar.

I am not 100% happy at this point because node-canvas I have not found a way how to create a higher DPI version of the image.

Additionally, I'd like to see xbar support plugins in a folder (https://github.com/matryer/xbar/issues/791) since that would make dependency management like node modules a bit easier and exchangeable.

Screen Shot 2021-11-12 at 18 40 14

I may end up putting the code for this script on GitHub in the future but right now it's just on my MacBook for testing 🙈.

Cheers and have a great weekend 🌸

chrisspiegl avatar Nov 12 '21 17:11 chrisspiegl

I did push an initial release of my xbar plugin which does internet speed testing. But relevant to this conversation, it does render two lines in the menu bar by doing so in an image via node-canvas.

Something to note about the image rendering is that, at least at the moment, it does not seem to render in retina. It's apparently 96dpi and is not possible to go any higher.

I am still trying to figure out how that may be adjusted / changed / improved (and I have seen one promising gist which may help with that). But as with many things: this will take time.

One more note: this is a workflow written 100% in node.js. This will not solve the long term problem / request of being able to show two lines in the menu bar… but it is a workaround which you may want to use for the time being.

https://github.com/chrisspiegl/xbar-internet-speedtest

chrisspiegl avatar Dec 31 '21 17:12 chrisspiegl