From 3fa0d6cdba20fad7ea8a0aeb1b69b11a0b3ab93f Mon Sep 17 00:00:00 2001 From: Baptiste Grob <60621355+baptiste-grob@users.noreply.github.com> Date: Fri, 7 Aug 2020 17:22:47 +0200 Subject: [PATCH] feature: expose desktop manager for Electron --- app/assets/javascripts/ui_models/application_group.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/ui_models/application_group.ts b/app/assets/javascripts/ui_models/application_group.ts index f8210efb3..125519373 100644 --- a/app/assets/javascripts/ui_models/application_group.ts +++ b/app/assets/javascripts/ui_models/application_group.ts @@ -34,6 +34,13 @@ export class ApplicationGroup { this.$rootScope = $rootScope; this.onApplicationDeinit = this.onApplicationDeinit.bind(this); this.createDefaultApplication(); + + /** FIXME(baptiste): rely on a less fragile method to detect Electron */ + if ((window as any).isElectron) { + Object.defineProperty(window, 'desktopManager', { + get: () => this.activeApplication?.getDesktopService() + }); + } } private createDefaultApplication() {