Skip to content

Build your personal knowledge base with Trilium Notes

fix .desktop + allow to turn this feature off

azivner8159564885ee
diff --git a/src/services/app_icon.js b/src/services/app_icon.js
index ff10e94a51..3e07946679 100644
--- a/src/services/app_icon.js
+++ b/src/services/app_icon.js
@@ -1,10 +1,11 @@
"use strict";
const path = require('path');
-const {APP_PNG_ICON_DIR} = require("./resource_dir");
+const {APP_PNG_ICON_DIR, ELECTRON_APP_ROOT_DIR} = require("./resource_dir");
const log = require("./log");
const os = require('os');
const fs = require('fs');
+const config = require('./config');
const template = `[Desktop Entry]
Type=Application
@@ -19,8 +20,8 @@ Terminal=false
* Installs .desktop icon into standard ~/.local/share/applications directory.
* We overwrite this file during every run as it might have been updated.
*/
-async function installLocalAppIcon() {
- if (["win32", "darwin"].includes(os.platform())) {
+function installLocalAppIcon() {
+ if (["win32", "darwin"].includes(os.platform()) || (config.General && config.General.noDesktopIcon)) {
return;
}
@@ -55,9 +56,7 @@ function escapePath(path) {
}
function getExePath() {
- const appPath = require('electron').app.getAppPath();
-
- return path.resolve(appPath, 'trilium');
+ return path.resolve(ELECTRON_APP_ROOT_DIR, 'trilium');
}
module.exports = {
diff --git a/src/services/resource_dir.js b/src/services/resource_dir.js
index bf2b3d430b..2077e9f70e 100644
--- a/src/services/resource_dir.js
+++ b/src/services/resource_dir.js
@@ -4,6 +4,8 @@ const fs = require('fs');
const RESOURCE_DIR = path.resolve(__dirname, "../..");
+// where "trilium" executable is
+const ELECTRON_APP_ROOT_DIR = path.resolve(RESOURCE_DIR, "../..");
const DB_INIT_DIR = path.resolve(RESOURCE_DIR, "db");
const APP_PNG_ICON_DIR = path.resolve(RESOURCE_DIR, "src/public/images/app-icons/png");
@@ -23,5 +25,6 @@ module.exports = {
RESOURCE_DIR,
MIGRATIONS_DIR,
DB_INIT_DIR,
+ ELECTRON_APP_ROOT_DIR,
APP_PNG_ICON_DIR
};
\ No newline at end of file