From bb0f0ac3990c1d5684eddd88f512c1496a41ce66 Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Fri, 21 Jun 2024 11:39:12 +0200 Subject: [PATCH 1/3] chore(compass): explicitly set secret store to gnome-libsecret on linux if not set --- packages/compass/src/main/application.ts | 7 ------- .../compass/src/setup-hadron-distribution.ts | 20 +++++++++++++++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/packages/compass/src/main/application.ts b/packages/compass/src/main/application.ts index 360987067bb..1738892135c 100644 --- a/packages/compass/src/main/application.ts +++ b/packages/compass/src/main/application.ts @@ -139,7 +139,6 @@ class CompassApplication { } await setupCSFLELibrary(); setupTheme(this); - this.setupJavaScriptArguments(); this.setupLifecycleListeners(); this.setupApplicationMenu(); this.setupWindowManager(); @@ -160,12 +159,6 @@ class CompassApplication { }); } - private static setupJavaScriptArguments(): void { - // For Linux users with drivers that are avoided by Chromium we disable the - // GPU check to attempt to bypass the disabled WebGL settings. - app.commandLine.appendSwitch('ignore-gpu-blacklist', 'true'); - } - private static setupAutoUpdate(): void { CompassAutoUpdateManager.init(this); } diff --git a/packages/compass/src/setup-hadron-distribution.ts b/packages/compass/src/setup-hadron-distribution.ts index 534a402175f..ee0c9bd4bbe 100644 --- a/packages/compass/src/setup-hadron-distribution.ts +++ b/packages/compass/src/setup-hadron-distribution.ts @@ -32,6 +32,26 @@ if ( // type `browser` indicates that we are in the main electron process process.type === 'browser' ) { + if (process.platform === 'linux') { + // For Linux users with drivers that are avoided by Chromium we disable the + // GPU check to attempt to bypass the disabled WebGL settings. + app.commandLine.appendSwitch('ignore-gpu-blacklist', 'true'); + + /** + * Default password store detection in Chromium relies on pre-defined set of + * values for XDG_CURRENT_DESKTOP env var. Even if the store is installed + * correctly, Chromium might fail to detect that. To try to work around that + * we explicitly set password-store to gnome-libsecret for any linux + * platform (we list gnome-keyring as a dependency for all compass + * installers on linux) + * + * @see {@link https://github.com/microsoft/vscode/issues/185212#issuecomment-1593271415} + */ + if (app.commandLine.hasSwitch('password-store') === false) { + app.commandLine.appendSwitch('gnome-libsecret'); + } + } + // Name and version are setup outside of Application and before anything else // so that if uncaught exception happens we already show correct name and // version From b7967a557d9989f15e041a83e4010e9a86f88fe6 Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Fri, 21 Jun 2024 11:51:23 +0200 Subject: [PATCH 2/3] fix: actually set the flag... --- packages/compass/src/setup-hadron-distribution.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/compass/src/setup-hadron-distribution.ts b/packages/compass/src/setup-hadron-distribution.ts index ee0c9bd4bbe..eed80591236 100644 --- a/packages/compass/src/setup-hadron-distribution.ts +++ b/packages/compass/src/setup-hadron-distribution.ts @@ -48,7 +48,7 @@ if ( * @see {@link https://github.com/microsoft/vscode/issues/185212#issuecomment-1593271415} */ if (app.commandLine.hasSwitch('password-store') === false) { - app.commandLine.appendSwitch('gnome-libsecret'); + app.commandLine.appendSwitch('password-store', 'gnome-libsecret'); } } From 89b8d1f6bc0fdd01d9d0d5a9a6449860b3023942 Mon Sep 17 00:00:00 2001 From: Sergey Petushkov Date: Thu, 20 Feb 2025 10:45:47 +0100 Subject: [PATCH 3/3] chore(compass): check for libsecret before setting the flag --- packages/compass/src/setup-hadron-distribution.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/compass/src/setup-hadron-distribution.ts b/packages/compass/src/setup-hadron-distribution.ts index eed80591236..2713f98d59a 100644 --- a/packages/compass/src/setup-hadron-distribution.ts +++ b/packages/compass/src/setup-hadron-distribution.ts @@ -33,6 +33,15 @@ if ( process.type === 'browser' ) { if (process.platform === 'linux') { + const isLibsecretInstalled = () => { + try { + process.dlopen({ exports: {} }, 'libsecret-1.so.0'); + return true; + } catch (err: any) { + return err && err.message?.includes('did not self-register'); + } + }; + // For Linux users with drivers that are avoided by Chromium we disable the // GPU check to attempt to bypass the disabled WebGL settings. app.commandLine.appendSwitch('ignore-gpu-blacklist', 'true'); @@ -47,7 +56,10 @@ if ( * * @see {@link https://github.com/microsoft/vscode/issues/185212#issuecomment-1593271415} */ - if (app.commandLine.hasSwitch('password-store') === false) { + if ( + app.commandLine.hasSwitch('password-store') === false && + isLibsecretInstalled() + ) { app.commandLine.appendSwitch('password-store', 'gnome-libsecret'); } }