core: add IgnoreSystemSettings pragma

This commit is contained in:
outfoxxed 2024-04-07 23:21:06 -07:00
parent ff8e252944
commit 0b2baea230
Signed by: outfoxxed
GPG Key ID: 4C88A185FB89301E
1 changed files with 6 additions and 5 deletions

View File

@ -27,6 +27,7 @@ int qs_main(int argc, char** argv) {
auto useQApplication = false;
auto nativeTextRendering = false;
auto desktopSettingsAware = true;
QHash<QString, QString> envOverrides;
{
@ -271,6 +272,7 @@ int qs_main(int argc, char** argv) {
if (pragma == "UseQApplication") useQApplication = true;
else if (pragma == "NativeTextRendering") nativeTextRendering = true;
else if (pragma == "IgnoreSystemSettings") desktopSettingsAware = false;
else if (pragma.startsWith("Env ")) {
auto envPragma = pragma.sliced(4);
auto splitIdx = envPragma.indexOf('=');
@ -297,7 +299,9 @@ int qs_main(int argc, char** argv) {
qputenv(var.toUtf8(), val.toUtf8());
}
QCoreApplication* app = nullptr;
QGuiApplication::setDesktopSettingsAware(desktopSettingsAware);
QGuiApplication* app = nullptr;
if (useQApplication) {
app = new QApplication(argc, argv);
@ -305,9 +309,6 @@ int qs_main(int argc, char** argv) {
app = new QGuiApplication(argc, argv);
}
QCoreApplication::setApplicationName("quickshell");
QCoreApplication::setApplicationVersion("0.1.0 (" GIT_REVISION ")");
if (!workingDirectory.isEmpty()) {
QDir::setCurrent(workingDirectory);
}
@ -325,7 +326,7 @@ int qs_main(int argc, char** argv) {
auto root = RootWrapper(configFilePath);
QGuiApplication::setQuitOnLastWindowClosed(false);
auto code = QCoreApplication::exec();
auto code = QGuiApplication::exec();
delete app;
return code;
}