matryer / xbar

Put the output from any script or program into your macOS Menu Bar (the BitBar reboot)
https://xbarapp.com
MIT License
17.55k stars 643 forks source link

Remain left most menu item #678

Closed adamkdean closed 3 years ago

adamkdean commented 3 years ago

With the original BitBar, if new menu icons appeared, you could refresh all BitBar scripts and they would appear on the left. However with the recent updates, while refresh still works, the menu objects are no longer recreated and thus, if you wish to position XBar back on the left-most side of icons, you have to quit and restart it.

I use a single script that displays text, so I like to keep it on the left. I imagine with icons it doesn't matter their position.

image

(IP obfuscated, but usually text is there, not a gap)

Is there anything we can do to ensure it remains on the left?

magicus commented 3 years ago

I wonder if this is also related to how xbar behaves in conjunction with Bartender 4. I'm running both, and most of the times it works fine, and sometimes the icons just gets shuffled around. I was planning on opening a bug as soon as I had figured out exactly what was going on. Restarting/refreshing tend to mess with things, though, is my impression.

matryer commented 3 years ago

@adamkdean @magicus thanks for reporting this, I don't see this behaviour. Perhaps you can elaborate on exactly what you have running so I can try and recreate it?

leaanthony commented 3 years ago

I've just looked through the BitBar code and there's nothing to indicate a preferred location within the system extras panel, so I suspect that Bartender is moving them around. If you are keen on setting this as a preference, there's an interesting thread here about doing just that. However, I suspect Bartender may be modifying these preferences to do what it does so YMMV.

adamkdean commented 3 years ago

@matryer Other than a few other apps that also place items in the menu bar, it's just XBar. No Bartender or any other menu bar altering applications. Here's something you may be able to do to try and replace it:

Create an XBar plugin script that simply outputs some text, and then after that has launched, launch or restart any app that also places an item in the menu bar. If you have nothing ordering the icons, then the new icon (of the app you launched after XBar) would be placed on the left most side, moving your XBar text further toward the right.

If you then click the XBar plugin text and select refresh, you'd expect it to appear on the left most side again (at least, that was the behaviour within Bitbar), but for me, it retains its position.

I'm not necessarily sure if this is a bug really, just a curious change in behaviour from Bitbar.

Thanks all for your contributions

leaanthony commented 3 years ago

It sounds like bitbar would remove the different components rather than refresh them.

matryer commented 3 years ago

I think BitBar would destroy and recreate menus. xbar is more memory efficient, and reuses the menu items if it can. So I'd say this is expected behaviour now. I don't think there's much we can do to ensure xbar appears on the left, except maybe delay it starting up or something - but that seems strange.

Closing this for now.

adamkdean commented 3 years ago

That makes sense. No worries folks, thanks for discussing.