Bitbar: Keeps losing position in menu bar

Created on 19 Jul 2018  Â·  11Comments  Â·  Source: matryer/bitbar

Since at least Sierra, macOS lets us command-drag an item in the menu bar to a non-default position. BitBar menu bar items keep losing the custom position given by command-dragging however. Is there any way to prevent this?

Most helpful comment

I built a bit on @sohocoke's work and re-added the "Refresh All" to the menu which just calls setupAllPlugins. So now it both starts up and refreshes without losing position. I left "Reset All" in there just in case you actually want to reset the positions...for reasons.

While I was in there I also made it a bit simpler to build. Assuming you have XCode installed, you should be able to just clone my repo and run make. The built application will be ./App/build/Release/BitBar.app. Enjoy.

Fork here: https://github.com/rashidkpc/bitbar

All 11 comments

I've noticed this too, and it's also a problem with Bartender installed. Other applications have the same problem, e.g. Mountain and MUMenu. They simply lose track of their menu bar position after reboot, login, or wake-from-sleep.

It's even trickier with menu bar apps that have multiple icons like BitBar or iStatMenus. In the latter case, the Bartender developers actually managed to make this work, so the user can now position individual iStatMenus tools whereever he wants, but the menu bar app needs to support that. BitBar doesn't seem to at the moment.

We already have a topic on this – https://github.com/matryer/bitbar/issues/241 – so this one can be closed imho.

Same here and I do not have Bartender. It happens on wake up (Sierra) and also if you choose the "Refresh all" command from the Preferences menu.

Took an evening to dig a little. The plugin menu items are torn down and set up whenever setupAllPlugins is called, which means the OS loses track of the custom positions when this happens.

This happens in a few different situations; the one I findmost annoying is when the system wakes up from sleep. The above PR fixes this case.

I built a bit on @sohocoke's work and re-added the "Refresh All" to the menu which just calls setupAllPlugins. So now it both starts up and refreshes without losing position. I left "Reset All" in there just in case you actually want to reset the positions...for reasons.

While I was in there I also made it a bit simpler to build. Assuming you have XCode installed, you should be able to just clone my repo and run make. The built application will be ./App/build/Release/BitBar.app. Enjoy.

Fork here: https://github.com/rashidkpc/bitbar

What sets the initial order in the bar? I was assuming the scripts would be called in alphanumeric order and added to the bar as they finished... serially. However, I've had them appear in other orders after reboot. Adding in alphanumeric order would be nice... so this would work for setting the order in the bar... once and done...

00-tracker.10m
10-bandwidth-test-min.1h
20-ping-test-min.1m
30-ssh-menu.1h
40-brew-services.10m

No more "get whatever order you get... then cmd-drag them around... rinse... repeat..."

@neuronsong see #468 this approach does not work for all people and may only work for a while.

The order of the items in the top bar appears to be unrelated to the file name, but rather determined by inode number (right-most being the lowest inode). Every time I've refreshed the bitbar, scripts are displayed in inode order. Tested on macOS 10.15.7. I have not tested for scripts with different refresh rates.

The inconsistent results users are getting when renaming files can be explained by people using either symlinks or script files directly. When renaming a regular file, the file does not get a new inode number. When renaming a symlink, a new inode is created.

A consistent way to set the order (tested with scripts that all have the same refresh rate) is to make symlinks to the script files in the correct order. Rightmost item symlink should be created first. If you prefer to use script files directly without linking, then use cp to copy each file in the correct order. Use ls -1i | sort -n to check whether the order is correct.

I'm not sure if the issue can be considered closed. The original question was not about the relative order of Bitbar plugins among themselves, but rather the position of the whole BitBar display (I only have one plugin), which seems to be always shoved to the leftmost position on the menu bar (and becomes hidden due to there being a huge number of menubar icons already) after MacOS wakes up from sleep.

Remaining closed.

You can use something like https://github.com/Mortennn/Dozer to manage your menu item positions.

Update: Bartender actually works in maintaining BitBar's position in the menu bar. Dozer didn't seem to work though.

Dozer works for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JayBrown picture JayBrown  Â·  6Comments

javray picture javray  Â·  11Comments

alesf picture alesf  Â·  7Comments

BigPrimeNumbers picture BigPrimeNumbers  Â·  4Comments

fenhl picture fenhl  Â·  4Comments