mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
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:
commit
9b67dca15b
1 changed files with 14 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue