Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/keepassxreboot/keepassxc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlemens Nanni <klemens@posteo.de>2022-06-24 17:59:06 +0300
committerJonathan White <support@dmapps.us>2022-09-22 13:49:07 +0300
commit74e1e7c9d1bba087b85b66b9795e26a8cbba3194 (patch)
treedb8be50053446e8a8556d8f287447f075b91f2b5
parent7de9ab25ab4223572a64d7391d2aa20fb56b36ba (diff)
autostart: Linux: Exec= filename not absolute path
Systems like NixOS install software under unique paths, so persisting the absolute file path in the generated .desktop file when enabling autostart will eventually point at an outdated or nonexistent program. Another possible issue with using Qt's `applicationFilePath()` is that the final program's basename (`argv[0]`) might not be the same as what the user initially executed to start KeePassXC. Use the file name and thus rely on `PATH` lookup just like the static .desktop file does to lift those issues and defer execution logic (`PATH` lookup, wrapper scripts, etc.) to the operating system.
-rw-r--r--src/gui/osutils/nixutils/NixUtils.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/osutils/nixutils/NixUtils.cpp b/src/gui/osutils/nixutils/NixUtils.cpp
index d0fa84f3c..ba44cd273 100644
--- a/src/gui/osutils/nixutils/NixUtils.cpp
+++ b/src/gui/osutils/nixutils/NixUtils.cpp
@@ -128,15 +128,15 @@ void NixUtils::setLaunchAtStartup(bool enable)
const QString appImagePath = QString::fromLocal8Bit(qgetenv("APPIMAGE"));
const bool isAppImage = !appImagePath.isNull() && QFile::exists(appImagePath);
- const QString executeablePath = isAppImage ? appImagePath : QApplication::applicationFilePath();
+ const QString executeablePathOrName = isAppImage ? appImagePath : QApplication::applicationName().toLower();
QTextStream stream(&desktopFile);
stream.setCodec("UTF-8");
stream << QStringLiteral("[Desktop Entry]") << '\n'
<< QStringLiteral("Name=") << QApplication::applicationDisplayName() << '\n'
<< QStringLiteral("GenericName=") << tr("Password Manager") << '\n'
- << QStringLiteral("Exec=") << executeablePath << '\n'
- << QStringLiteral("TryExec=") << executeablePath << '\n'
+ << QStringLiteral("Exec=") << executeablePathOrName << '\n'
+ << QStringLiteral("TryExec=") << executeablePathOrName << '\n'
<< QStringLiteral("Icon=") << QApplication::applicationName().toLower() << '\n'
<< QStringLiteral("StartupWMClass=keepassxc") << '\n'
<< QStringLiteral("StartupNotify=true") << '\n'