mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2026-04-10 06:11:54 +10:00
launch: add ability to override AppId via pragma or QS_APP_ID
This commit is contained in:
parent
eb6eaf59c7
commit
77c04a9447
5 changed files with 16 additions and 6 deletions
|
|
@ -38,6 +38,7 @@ set shell id.
|
||||||
- Added `QS_DISABLE_FILE_WATCHER` environment variable to disable file watching.
|
- Added `QS_DISABLE_FILE_WATCHER` environment variable to disable file watching.
|
||||||
- Added `QS_DISABLE_CRASH_HANDLER` environment variable to disable crash handling.
|
- Added `QS_DISABLE_CRASH_HANDLER` environment variable to disable crash handling.
|
||||||
- Added `QS_CRASHREPORT_URL` environment variable to allow overriding the crash reporter link.
|
- Added `QS_CRASHREPORT_URL` environment variable to allow overriding the crash reporter link.
|
||||||
|
- Added `AppId` pragma and `QS_APP_ID` environment variable to allow overriding the desktop application ID.
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@
|
||||||
#include <qdatastream.h>
|
#include <qdatastream.h>
|
||||||
|
|
||||||
QDataStream& operator<<(QDataStream& stream, const InstanceInfo& info) {
|
QDataStream& operator<<(QDataStream& stream, const InstanceInfo& info) {
|
||||||
stream << info.instanceId << info.configPath << info.shellId << info.launchTime << info.pid
|
stream << info.instanceId << info.configPath << info.shellId << info.appId << info.launchTime
|
||||||
<< info.display;
|
<< info.pid << info.display;
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
QDataStream& operator>>(QDataStream& stream, InstanceInfo& info) {
|
QDataStream& operator>>(QDataStream& stream, InstanceInfo& info) {
|
||||||
stream >> info.instanceId >> info.configPath >> info.shellId >> info.launchTime >> info.pid
|
stream >> info.instanceId >> info.configPath >> info.shellId >> info.appId >> info.launchTime
|
||||||
>> info.display;
|
>> info.pid >> info.display;
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ struct InstanceInfo {
|
||||||
QString instanceId;
|
QString instanceId;
|
||||||
QString configPath;
|
QString configPath;
|
||||||
QString shellId;
|
QString shellId;
|
||||||
|
QString appId;
|
||||||
QDateTime launchTime;
|
QDateTime launchTime;
|
||||||
pid_t pid = -1;
|
pid_t pid = -1;
|
||||||
QString display;
|
QString display;
|
||||||
|
|
|
||||||
|
|
@ -230,7 +230,9 @@ void qsCheckCrash(int argc, char** argv) {
|
||||||
);
|
);
|
||||||
|
|
||||||
auto app = QApplication(argc, argv);
|
auto app = QApplication(argc, argv);
|
||||||
QApplication::setDesktopFileName("org.quickshell");
|
auto desktopId =
|
||||||
|
info.instance.appId.isEmpty() ? QStringLiteral("org.quickshell") : info.instance.appId;
|
||||||
|
QApplication::setDesktopFileName(desktopId);
|
||||||
|
|
||||||
auto crashDir = QsPaths::crashDir(info.instance.instanceId);
|
auto crashDir = QsPaths::crashDir(info.instance.instanceId);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
|
||||||
bool useSystemStyle = false;
|
bool useSystemStyle = false;
|
||||||
QString iconTheme = qEnvironmentVariable("QS_ICON_THEME");
|
QString iconTheme = qEnvironmentVariable("QS_ICON_THEME");
|
||||||
QHash<QString, QString> envOverrides;
|
QHash<QString, QString> envOverrides;
|
||||||
|
QString appId = qEnvironmentVariable("QS_APP_ID");
|
||||||
QString dataDir;
|
QString dataDir;
|
||||||
QString stateDir;
|
QString stateDir;
|
||||||
QString cacheDir;
|
QString cacheDir;
|
||||||
|
|
@ -104,6 +105,8 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
|
||||||
auto var = envPragma.sliced(0, splitIdx).trimmed();
|
auto var = envPragma.sliced(0, splitIdx).trimmed();
|
||||||
auto val = envPragma.sliced(splitIdx + 1).trimmed();
|
auto val = envPragma.sliced(splitIdx + 1).trimmed();
|
||||||
pragmas.envOverrides.insert(var, val);
|
pragmas.envOverrides.insert(var, val);
|
||||||
|
} else if (pragma.startsWith("AppId ")) {
|
||||||
|
pragmas.appId = pragma.sliced(6).trimmed();
|
||||||
} else if (pragma.startsWith("ShellId ")) {
|
} else if (pragma.startsWith("ShellId ")) {
|
||||||
shellId = pragma.sliced(8).trimmed();
|
shellId = pragma.sliced(8).trimmed();
|
||||||
} else if (pragma.startsWith("DataDir ")) {
|
} else if (pragma.startsWith("DataDir ")) {
|
||||||
|
|
@ -128,10 +131,13 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
|
||||||
qInfo() << "Shell ID:" << shellId << "Path ID" << pathId;
|
qInfo() << "Shell ID:" << shellId << "Path ID" << pathId;
|
||||||
|
|
||||||
auto launchTime = qs::Common::LAUNCH_TIME.toSecsSinceEpoch();
|
auto launchTime = qs::Common::LAUNCH_TIME.toSecsSinceEpoch();
|
||||||
|
auto appId = pragmas.appId.isEmpty() ? QStringLiteral("org.quickshell") : pragmas.appId;
|
||||||
|
|
||||||
InstanceInfo::CURRENT = InstanceInfo {
|
InstanceInfo::CURRENT = InstanceInfo {
|
||||||
.instanceId = base36Encode(getpid()) + base36Encode(launchTime),
|
.instanceId = base36Encode(getpid()) + base36Encode(launchTime),
|
||||||
.configPath = args.configPath,
|
.configPath = args.configPath,
|
||||||
.shellId = shellId,
|
.shellId = shellId,
|
||||||
|
.appId = appId,
|
||||||
.launchTime = qs::Common::LAUNCH_TIME,
|
.launchTime = qs::Common::LAUNCH_TIME,
|
||||||
.pid = getpid(),
|
.pid = getpid(),
|
||||||
.display = getDisplayConnection(),
|
.display = getDisplayConnection(),
|
||||||
|
|
@ -231,7 +237,7 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
|
||||||
app = new QGuiApplication(qArgC, argv);
|
app = new QGuiApplication(qArgC, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
QGuiApplication::setDesktopFileName("org.quickshell");
|
QGuiApplication::setDesktopFileName(appId);
|
||||||
|
|
||||||
if (args.debugPort != -1) {
|
if (args.debugPort != -1) {
|
||||||
QQmlDebuggingEnabler::enableDebugging(true);
|
QQmlDebuggingEnabler::enableDebugging(true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue