diff --git a/CMakeLists.txt b/CMakeLists.txt index c8670013..6b962d94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ boption(SERVICE_GREETD "Greetd" ON) boption(SERVICE_UPOWER "UPower" ON) boption(SERVICE_NOTIFICATIONS "Notifications" ON) boption(BLUETOOTH "Bluetooth" ON) +boption(WEBVIEW "WebView" ON) include(cmake/install-qml-module.cmake) include(cmake/util.cmake) @@ -128,6 +129,10 @@ if (DBUS) list(APPEND QT_FPDEPS DBus) endif() +if (WEBVIEW) + list(APPEND QT_FPDEPS WebView) +endif() + find_package(Qt6 REQUIRED COMPONENTS ${QT_FPDEPS}) # In Qt 6.10, private dependencies are required to be explicit, diff --git a/src/launch/CMakeLists.txt b/src/launch/CMakeLists.txt index 4db11bf0..358c9791 100644 --- a/src/launch/CMakeLists.txt +++ b/src/launch/CMakeLists.txt @@ -11,6 +11,11 @@ target_link_libraries(quickshell-launch PRIVATE Qt::Quick Qt::Widgets CLI11::CLI11 quickshell-build ) +if(WEBVIEW) + add_compile_definitions(WEBVIEW_ENABLED) + target_link_libraries(quickshell-launch PRIVATE Qt::WebView) +endif() + qs_add_pchset(launch DEPENDENCIES Qt::Core CLI11::CLI11 HEADERS diff --git a/src/launch/launch.cpp b/src/launch/launch.cpp index f269f61d..7585717c 100644 --- a/src/launch/launch.cpp +++ b/src/launch/launch.cpp @@ -17,6 +17,10 @@ #include #include +#ifdef WEBVIEW_ENABLED +#include +#endif + #include "../core/common.hpp" #include "../core/instanceinfo.hpp" #include "../core/logging.hpp" @@ -222,7 +226,13 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio delete coreApplication; QGuiApplication* app = nullptr; - auto qArgC = 0; + auto qArgC = 1; + +#ifdef WEBVIEW_ENABLED + if (qEnvironmentVariable("QS_WEBVIEW", "0") == "1") { + QtWebView::initialize(); + } +#endif if (pragmas.useQApplication) { app = new QApplication(qArgC, argv);