Skip to content

Commit

Permalink
Ensure correct look of auto-started ownCloud client
Browse files Browse the repository at this point in the history
When installed as a native package (built by our new packaging system), we must make sure to run the client with the environment variables it is supposed to run with. Otherwise, its look and feel fall back to some unintended defaults.
  • Loading branch information
Fabian Müller authored and fmoc committed Oct 31, 2023
1 parent 610b293 commit 12f366e
Showing 1 changed file with 17 additions and 1 deletion.
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

0 comments on commit 12f366e

Please sign in to comment.