mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
committed by
Jonathan White
parent
2ddd61cff6
commit
031f31f83f
@@ -92,13 +92,18 @@ void NixUtils::setLaunchAtStartup(bool enable)
|
||||
qWarning("Failed to create autostart desktop file.");
|
||||
return;
|
||||
}
|
||||
|
||||
const QString appImagePath = QString::fromLocal8Bit(qgetenv("APPIMAGE"));
|
||||
const bool isAppImage = !appImagePath.isNull() && QFile::exists(appImagePath);
|
||||
const QString executeablePath = isAppImage ? appImagePath : QApplication::applicationFilePath();
|
||||
|
||||
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=") << QApplication::applicationFilePath() << '\n'
|
||||
<< QStringLiteral("TryExec=") << QApplication::applicationFilePath() << '\n'
|
||||
<< QStringLiteral("Exec=") << executeablePath << '\n'
|
||||
<< QStringLiteral("TryExec=") << executeablePath << '\n'
|
||||
<< QStringLiteral("Icon=") << QApplication::applicationName().toLower() << '\n'
|
||||
<< QStringLiteral("StartupWMClass=keepassxc") << '\n'
|
||||
<< QStringLiteral("StartupNotify=true") << '\n'
|
||||
|
||||
Reference in New Issue
Block a user