matryer / xbar

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

Waking up from sleep or "Refresh all" resets custom positions #787

Open ArloL opened 2 years ago

ArloL commented 2 years ago

Thanks for this wonderful tool :) Customizing the menu bar is a lot of fun!

I was noticing an issue where the position of the icons gets reset:

https://user-images.githubusercontent.com/195367/139425738-7fda40c6-7bf1-42ec-ada9-5249ec79174a.mov

Is this expected behavior? It also happens when I close / open the lid of the laptop.

I am using xbar 2.1.7-beta on macOS 11.6.1

Let me know if I can give you more details.

Thanks!

I am only running this script:

#!/bin/sh
if pgrep "VBoxHeadless" > /dev/null; then
    echo ◼︎
elif pgrep "mutagen" > /dev/null; then
    echo ◼︎
elif pgrep -f "react-scripts" > /dev/null; then
    echo ◼︎
else
    echo ◻
fi
taras-mukin commented 2 years ago

I'm seeing the same behaviour, would love to see it fixed

matryer commented 2 years ago

This is a Wails question, @leaanthony is there an event or something that occurs when people move the items in the menu bar. When xbar refreshes, it should reuse the old menus (it may be creating new ones).

leaanthony commented 2 years ago

Just thinking that it will create the menu in the order that they are given. If they are stored in a map the order might be different?

taras-mukin commented 2 years ago

So I've paid a bit more attention to the behaviour and it seems like xbar just freezes completely sometimes, and probably if after that lid is closed positions get reset, or something like that. By "freezes" I mean items stop updating on their own, default menu on click still shows up, but "refresh" and "refresh all" options also do nothing. This is also not just script not working -- if this happens xbar shows previous output in gray text, which is not the case here. Complete quit and restart helps, and if done manually positions do restore to where they need to be.

timkite commented 1 year ago

I'm also seeing this (macOS 13.1, xbar 2.1.7-beta via Homebrew, M1 MacBook Air) and it was driving me a bit crazy until I hit on the right search terms to find this issue. I have a single script running in xbar (a VPN monitor) and a Refresh All or the machine sitting idle long enough with the screen locked (not sleeping) causes the menu bar item to reset to the far left. Interestingly a reboot does not (it keeps its position from before the reboot)!