helloSystem / Filer

A file manager that can also render the desktop
GNU General Public License v2.0
32 stars 8 forks source link

Filer has its own static menu bar underneath the normal one #85

Closed antonpat closed 3 years ago

antonpat commented 3 years ago

0E186-12.2 There are 2 menu bars - one on the top of another. The topmost one is a normal menubar, that displays menu properly for most apps except of Filer. If I kill the process, I can see another transparent menu bar that displays static Filer menus that arealo present in the Filer windows. menu

ghost commented 3 years ago

I'm confused as to what you mean - if you kill the menubar, there is going to be a menu on the desktop instead of the global menu (it's the filer menubar). That's expected. How do you know there's one 'underneath'?

ghost commented 3 years ago

Ah I see what you mean - global menus not working for filer in general.

@probonopd it's filer starting before the menu...

If I kill filer and start it again after the menu has loaded, all works fine

antonpat commented 3 years ago

There was no filer menu bar visible in previous versions (I know it for sure - I've killed the menu bar process many times).

ghost commented 3 years ago

I know, it's new 😀

We added menus for the desktop window for filer, but in this case it's starting before the menubar has a chance to grab it

antonpat commented 3 years ago

Oh, I see now. Yes, it is visible for a split second before the normal menu bar appears during the startup.

probonopd commented 3 years ago

We do start the Menu before we start Filer, but possibly there is a race condition.

https://github.com/helloSystem/ISO/blob/cdf4ba4e243b78c82b0fbba886120344b00bd282/overlays/uzip/hello/files/usr/local/bin/start-hello#L264-L274

So we need to think about a way to start Filer only once we know that the Menu has published the D-Bus service.

Any ideas?

ghost commented 3 years ago

In the script can you wait for the service using dbus-send?

I'm not at my machine to check at the moment, but that might be a simple solution.

OK, I tried this and it looks like it could work:

HelloChris% dbus-send --print-reply --dest=org.freedesktop.DBus  /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep AppMenu
      string "com.canonical.AppMenu.Registrar"
probonopd commented 3 years ago

Yes, something like this is probably the way to go @moochris, but need to wrap it in a for loop and combine it with sleep, right?

ghost commented 3 years ago

Yes, I am not a shell script expert and I have been trying to work this out...

I thought this might work:

while [ $(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep AppMenu) ]
do
        sleep 1
done

However, that command substitution doesn't return empty if it isn't found (so the while loop never runs) - it seems to return a blank line. So I'm a bit stuck now :disappointed:

probonopd commented 3 years ago

This is not tested yet, but maybe something along those lines might do?

while true; do 
  RESULT=$(dbus-send --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep AppMenu)
  if [ "${RESULT}" != "" ] ; then
    break
  fi
done
probonopd commented 3 years ago

Turns out that we need the bash wait code anyway so that Autostart works correctly with applications that put icons into the upper-right hand corner of the menu.

Hence, added in https://github.com/helloSystem/ISO/commit/02cccbf60c500bb79b22db72c32580c6878be190.