FocusApp dbus method doesn't work correctly the first time it's called
Affected version
- Ubuntu 20.10
- GNOME Shell 3.38.1
- XOrg
Bug summary
If there's a call to the FocusApp
shell dbus method to focus an icon that is not in the first page, the page is not changed correctly the first time.
Steps to reproduce
- Start a fresh gnome-shell
- Call FocusApp with an app that's not in the first page
dbus-send --session --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.FocusApp string:org.gnome.Totem.desktop
- The page is not set correctly and the app grid shows the first one
- If you run the same command again, this will work correctly
What happened
The app grid is not placed in the correct page, it's the first one the first time the FocusApp is called.
What did you expect to happen
The app grid shows the correct page.
Relevant logs, screenshots, screencasts etc.
I think that the problem is because the first time you call this, the app grid is not created, so the method is called during the widgets allocation and we can see that there are some lines on BaseAppView.adaptToSize
that just sets the page to zero:
https://gitlab.gnome.org/GNOME/gnome-shell/-/blob/master/js/ui/appDisplay.js#L847-849
I think that the adaptToSize
is being called after page change done by FocusApp
so the page is always the first one.