Can't disable 'Allow inhibiting shortcuts' dialog for an AppImage app

I’m running Fedora 44 Silverblue and I’m converting a flatpak app (Amiberry) to Appimage to easily bundle it with an extension I’m working on. The app captures the mouse and keyboard when you click on its main window and therefore displays the ‘Allow inhibiting shortcuts’ dialog which you can grant or deny and have that preference stored for future launches.

When the app runs in its original flatpak form this works fine and the dialog only shows up once the first time it is launched. When the app is launched as an app image, the preference flag is not saved and the dialog is shown no matter what every time.

Two things I’ve tried:

  • Running flatpak permission-set gnome shortcuts-inhibitor com.blitterstudio.amiberry.desktop GRANTED before the AppImage app runs. This works fine as long as the flatpak verison installed too. If the flatpak version is not installed that settings seemd to be ignored too.
  • Running gsettings set org.gnome.mutter.wayland xwayland-allow-grabs true and then gsettings set org.gnome.mutter.wayland xwayland-grab-access-rules "['gnome-boxes,remote-viewer,virt-viewer,virt-manager,vinagre,vncviewer,Xephyr,amiberry']". This doesn’t seem to do anything.

For the second solution, I used lg to try and figure out that the WM_CLASS was for the app but maybe I got that wrong.

I’m down to looking at the Gnome source code to try and figure out how this setting is being read and written, does anyone have any suggestions as to how I can debug this and either have the AppImage app correctly save this setting after displaying the dialog once or be able to disable this dialog for the Appimage app.

Not sure if this is the best solution but after doing some more research I found that Gnome seems to use the name of the command executing inside the AppImage and then look for a .desktop file with that same name (in my case amiberry.desktop) in .local/share/applications. If that file is found then the permissions set for amiberry.desktop will work fine. This explains why it was working when the flatpak version was installed because this meant a .desktop file was present.

In summary:

  • Using the name of the binary app executing inside the AppImage, create a .desktop file with that same name in .local/share/applications.

  • Use flatpak permission-set gnome shortcuts-inhibitor <binary_name>.desktop GRANTED or busctl --user call org.freedesktop.impl.portal.PermissionStore /org/freedesktop/impl/portal/PermissionStore org.freedesktop.impl.portal.PermissionStore SetPermission sbssas gnome 1 shortcuts-inhibitor <binary_name>.desktop 1 GRANTED to grant the permission.

  • Enjoy!