From 5c458bf02f55a02457d9bac9893ba91b6a1edcea Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Wed, 6 Oct 2021 17:24:30 +0200 Subject: [PATCH] fix(launcher): Exception in GNOME 3.36 due to `Shell.AppLaunchGPU` being undefined --- src/launcher.ts | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/launcher.ts b/src/launcher.ts index 9c2fbaf1..d72dc3c5 100644 --- a/src/launcher.ts +++ b/src/launcher.ts @@ -190,6 +190,11 @@ export class Launcher extends search.Search { } launch_desktop_entry(entry: JsonIPC.DesktopEntry) { + if (!("AppLaunchGpu" in Shell)) { + this.launch_gio(entry); + return; + } + const basename = (name: string): string => { return name.substr(name.indexOf('/applications/') + 14).replace('/', '-') } @@ -212,14 +217,7 @@ export class Launcher extends search.Search { log.error(`GNOME Shell cannot find desktop entry for ${desktop_entry_id}`) log.error(`pop-launcher will use Gio.DesktopAppInfo instead`); - const dapp = Gio.DesktopAppInfo.new_from_filename(entry.path); - - if (!dapp) { - log.error(`could not find desktop entry for ${entry.path}`); - return; - } - - this.launch_desktop_app(dapp, entry.path); + this.launch_gio(entry) return; } @@ -293,6 +291,17 @@ export class Launcher extends search.Search { }) } + launch_gio(entry: JsonIPC.DesktopEntry) { + const dapp = Gio.DesktopAppInfo.new_from_filename(entry.path); + + if (!dapp) { + log.error(`could not find desktop entry for ${entry.path}`); + return; + } + + this.launch_desktop_app(dapp, entry.path); + } + list_workspace(ext: Ext) { for (const window of ext.tab_list(Meta.TabList.NORMAL, null)) { this.windows.insert(window);