forked from quickshell/quickshell
refactor(wayland): seperate cmake files for modularity
This commit is contained in:
parent
5bbd0333ef
commit
c6dde9ca9d
28 changed files with 32 additions and 33 deletions
56
src/core/main.cpp
Normal file
56
src/core/main.cpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#include <qcommandlineoption.h>
|
||||
#include <qcommandlineparser.h>
|
||||
#include <qdir.h>
|
||||
#include <qguiapplication.h>
|
||||
#include <qlogging.h>
|
||||
#include <qobject.h>
|
||||
#include <qquickwindow.h>
|
||||
#include <qstandardpaths.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include "rootwrapper.hpp"
|
||||
|
||||
#ifdef CONF_LAYERSHELL
|
||||
#include <LayerShellQt/shell.h>
|
||||
#endif
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
const auto app = QGuiApplication(argc, argv);
|
||||
QGuiApplication::setApplicationName("quickshell");
|
||||
QGuiApplication::setApplicationVersion("0.0.1");
|
||||
|
||||
QCommandLineParser parser;
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
auto configOption = QCommandLineOption({"c", "config"}, "Path to configuration file.", "path");
|
||||
parser.addOption(configOption);
|
||||
parser.process(app);
|
||||
|
||||
QString configPath;
|
||||
if (parser.isSet(configOption)) {
|
||||
configPath = parser.value(configOption);
|
||||
} else {
|
||||
configPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
||||
configPath = QDir(QDir(configPath).filePath("quickshell")).filePath("shell.qml");
|
||||
}
|
||||
|
||||
qInfo() << "config file path:" << configPath;
|
||||
|
||||
if (!QFile(configPath).exists()) {
|
||||
qCritical() << "config file does not exist";
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if CONF_LAYERSHELL
|
||||
LayerShellQt::Shell::useLayerShell();
|
||||
#endif
|
||||
|
||||
// Base window transparency appears to be additive.
|
||||
// Use a fully transparent window with a colored rect.
|
||||
QQuickWindow::setDefaultAlphaBuffer(true);
|
||||
|
||||
auto root = RootWrapper(configPath);
|
||||
|
||||
return QGuiApplication::exec();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue