Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure correct look of auto-started ownCloud client #11323

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/common/utility_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <QCoreApplication>
#include <QDir>
#include <QFile>
#include <QSettings>
#include <QStandardPaths>
#include <QString>
#include <QTextStream>
Expand Down Expand Up @@ -79,7 +80,7 @@ void Utility::setLaunchOnStartup(const QString &appName, const QString &guiName,
return;
}

auto autostartApplicationPath = []() {
auto autostartApplicationPath = []() -> QString {
// $APPIMAGE will be set to the AppImage's path by the AppImage runtime
// if it is set, we can assume to be run from within an AppImage
// in that case, the desktop file should point to the AppImage rather than the
Expand All @@ -88,6 +89,21 @@ void Utility::setLaunchOnStartup(const QString &appName, const QString &guiName,
return Utility::appImageLocation();
}

// we need to launch the client via its provided AppRun script (or at least source the AppRun hooks) to make sure it is displayed correctly
// if installed as a native package generated by linuxdeploy-plugin-native_packages, a linuxdeploy.conf file will be available that points to the
// location of the installed AppDir
QString linuxdeployConfPath = qApp->applicationDirPath() + QStringLiteral("/linuxdeploy.conf");

if (QFile(linuxdeployConfPath).exists()) {
QSettings linuxdeployConf(linuxdeployConfPath, QSettings::IniFormat);

const auto appdirInstallatedPath = linuxdeployConf.value(QStringLiteral("native_packages/appdir_installed_path"));
if (!appdirInstallatedPath.isNull()) {
return appdirInstallatedPath.toString() + QStringLiteral("/AppRun");
}
}

// otherwise, we just use the application binary's own path, which should work for distribution-packaged installations and also for development
return QCoreApplication::applicationFilePath();
}();

Expand Down
Loading