From 3abf7e4662479bc875900b26c669a482d7e160f5 Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Mon, 19 Feb 2024 09:43:56 +0100 Subject: [PATCH] status/backgroundApps: Use ShellApp.activate_action() to quit apps `ShellApp` gained the ability to activated actions, therefore drop the current implementation in favor for it. Part-of: --- js/ui/status/backgroundApps.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/js/ui/status/backgroundApps.js b/js/ui/status/backgroundApps.js index 6c4b80601..df9b4ab1c 100644 --- a/js/ui/status/backgroundApps.js +++ b/js/ui/status/backgroundApps.js @@ -111,8 +111,6 @@ const BackgroundAppMenuItem = GObject.registerClass({ } async _quitApp() { - const appId = this.app.get_id().replace(/\.desktop$/, ''); - this._spinner.play(); this._spinnerTimeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, SPINNER_TIMEOUT, @@ -124,18 +122,10 @@ const BackgroundAppMenuItem = GObject.registerClass({ }); try { - await Gio.DBus.session.call( - appId, - `/${appId.replaceAll('.', '/')}`, - 'org.freedesktop.Application', - 'ActivateAction', - new GLib.Variant('(sava{sv})', ['quit', [], {}]), - null, - Gio.DBusCallFlags.NONE, - -1, - null); + await this.app.activate_action('quit', null, 0, -1, null); } catch (_error) { try { + const appId = this.app.get_id().replace(/\.desktop$/, ''); Util.trySpawn(['flatpak', 'kill', appId]); } catch (pidError) { logError(pidError, 'Failed to kill application');