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

View file

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