From 7521ac53a3c2e2d8caf2aa863c9b8a9c58fa5cbd Mon Sep 17 00:00:00 2001 From: infinite-persistence Date: Thu, 4 Mar 2021 14:14:19 +0800 Subject: [PATCH] Linux: Don't add extra call to associate 'lbry://' ## Issue Closes 4729: LBRY desktop auto-sets itself as default application for opening html files in Linux file managers like nemo after logout and login or a cold/warm boot - https://gitlab.freedesktop.org/xdg/xdg-utils/-/issues/180 - It appears that there is a piece of code in xdg that defaults the type to 'text/html' if the parameter is empty. I'm not sure if that's entirely xdg's fault, or it's the way Electron's `setAsDefaultProtocolClient` uses it. ## Changes In Linux Mint at least, it seems like the `protocols` entry in `electron-builder.json` is enough to associate the LBRY protocol to this app. The extra `setAsDefaultProtocolClient` seems unnecessary. My test method: With `setAsDefaultProtocolClient` removed for Linux, - still opens the app. - does not open the app if the `protocols` entry is removed from `electron-build.json` (confirming that it's doing it's job). --- electron/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/electron/index.js b/electron/index.js index c3fe1222c..c73564965 100644 --- a/electron/index.js +++ b/electron/index.js @@ -46,7 +46,10 @@ let lbryFirst; const appState = {}; -app.setAsDefaultProtocolClient('lbry'); +if (process.platform !== 'linux') { + app.setAsDefaultProtocolClient('lbry'); +} + app.name = 'LBRY'; app.setAppUserModelId('io.lbry.LBRY'); app.commandLine.appendSwitch('force-color-profile', 'srgb');