#include "DesktopIconProvider.hpp" #include #include #include #include #include #include #include #include #if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) #include #endif namespace { void initializeIconTheme() { if (QIcon::themeName().isEmpty()) { const QStringList candidates = { QStringLiteral("Adwaita"), QStringLiteral("Yaru"), QStringLiteral("ubuntu-mono-dark"), QStringLiteral("breeze"), QStringLiteral("hicolor"), }; const QStringList searchPaths = QIcon::themeSearchPaths(); for (const QString &theme : candidates) { for (const QString &root : searchPaths) { if (QDir(root + QLatin1Char('/') + theme).exists()) { QIcon::setThemeName(theme); break; } } if (!QIcon::themeName().isEmpty()) break; } } if (QIcon::fallbackThemeName().isEmpty()) QIcon::setFallbackThemeName(QStringLiteral("hicolor")); } } // namespace int main(int argc, char *argv[]) { #if QT_VERSION < QT_VERSION_CHECK(6, 5, 0) LayerShellQt::Shell::useLayerShell(); #endif QGuiApplication app(argc, argv); app.setApplicationName(QStringLiteral("nebula-shell")); app.setApplicationDisplayName(QStringLiteral("Nebula Desktop")); app.setOrganizationName(QStringLiteral("NebulaOS")); app.setDesktopFileName(QStringLiteral("org.nebulaos.shell")); initializeIconTheme(); QQuickWindow::setDefaultAlphaBuffer(true); QQmlApplicationEngine engine; engine.addImportPath(QStringLiteral("qrc:/qt/qml")); engine.addImageProvider(QStringLiteral("desktopicon"), new DesktopIconProvider); QObject::connect( &engine, &QQmlApplicationEngine::objectCreationFailed, &app, []() { qCritical("nebula-shell: failed to load the Nebula QML module."); QCoreApplication::exit(EXIT_FAILURE); }, Qt::QueuedConnection); #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) engine.loadFromModule(QStringLiteral("Nebula.Shell"), QStringLiteral("Main")); #else engine.load(QUrl(QStringLiteral("qrc:/qt/qml/Nebula/Shell/Main.qml"))); #endif if (engine.rootObjects().isEmpty()) { qCritical("nebula-shell: failed to load the Nebula QML module."); return EXIT_FAILURE; } return app.exec(); }