Merge branch 'more-access' into 'main'

accessDialog: Allow requests from apps in STARTING state

See merge request GNOME/gnome-shell!1928
This commit is contained in:
Florian Müllner 2024-06-30 02:19:27 +00:00
commit 9b67dca15b

View file

@ -133,11 +133,24 @@ export class AccessDialogDBus {
this._accessDialog = null;
this._windowTracker = Shell.WindowTracker.get_default();
this._appSystem = Shell.AppSystem.get_default();
this._dbusImpl = Gio.DBusExportedObject.wrapJSObject(AccessIface, this);
this._dbusImpl.export(Gio.DBus.session, '/org/freedesktop/portal/desktop');
}
_allowApp(id) {
if (!id)
return true; // not sandboxed
const app = this._appSystem.lookup_app(`${id}.desktop`);
if (!app)
return false; // non-graphical flatpak?
return app === this._windowTracker.focus_app ||
app.state === Shell.AppState.STARTING;
}
AccessDialogAsync(params, invocation) {
if (this._accessDialog) {
invocation.return_error_literal(
@ -150,7 +163,7 @@ export class AccessDialogDBus {
let [handle, appId, parentWindow_, title, description, body, options] = params;
// We probably want to use parentWindow and global.display.focus_window
// for this check in the future
if (appId && `${appId}.desktop` !== this._windowTracker.focus_app.id) {
if (!this._allowApp(appId)) {
invocation.return_error_literal(
Gio.DBusError,
Gio.DBusError.ACCESS_DENIED,