Skip to content

Commit 9945246

Browse files
Added support for webview and changed qArgc in launch.cpp from 0 to 1 since webview expects QCoreApplication to atleast have the program name as argument, otherwise aborts leading to a crash in quickshell.
1 parent 0085881 commit 9945246

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ boption(SERVICE_GREETD "Greetd" ON)
7171
boption(SERVICE_UPOWER "UPower" ON)
7272
boption(SERVICE_NOTIFICATIONS "Notifications" ON)
7373
boption(BLUETOOTH "Bluetooth" ON)
74+
boption(WEBVIEW "WebView" ON)
7475

7576
include(cmake/install-qml-module.cmake)
7677
include(cmake/util.cmake)
@@ -127,6 +128,10 @@ if (DBUS)
127128
list(APPEND QT_FPDEPS DBus)
128129
endif()
129130

131+
if (WEBVIEW)
132+
list(APPEND QT_FPDEPS WebView)
133+
endif()
134+
130135
find_package(Qt6 REQUIRED COMPONENTS ${QT_FPDEPS})
131136

132137
# In Qt 6.10, private dependencies are required to be explicit,

src/launch/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ target_link_libraries(quickshell-launch PRIVATE
1111
Qt::Quick Qt::Widgets CLI11::CLI11 quickshell-build
1212
)
1313

14+
if(WEBVIEW)
15+
add_compile_definitions(WEBVIEW_ENABLED)
16+
target_link_libraries(quickshell-launch PRIVATE Qt::WebView)
17+
endif()
18+
1419
qs_add_pchset(launch
1520
DEPENDENCIES Qt::Core CLI11::CLI11
1621
HEADERS

src/launch/launch.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <qtextstream.h>
1818
#include <unistd.h>
1919

20+
#ifdef WEBVIEW_ENABLED
21+
#include <QtWebView>
22+
#endif
23+
2024
#include "../core/common.hpp"
2125
#include "../core/instanceinfo.hpp"
2226
#include "../core/logging.hpp"
@@ -222,7 +226,13 @@ int launch(const LaunchArgs& args, char** argv, QCoreApplication* coreApplicatio
222226
delete coreApplication;
223227

224228
QGuiApplication* app = nullptr;
225-
auto qArgC = 0;
229+
auto qArgC = 1;
230+
231+
#ifdef WEBVIEW_ENABLED
232+
if (qEnvironmentVariable("QS_WEBVIEW", "0") == "1") {
233+
QtWebView::initialize();
234+
}
235+
#endif
226236

227237
if (pragmas.useQApplication) {
228238
app = new QApplication(qArgC, argv);

0 commit comments

Comments
 (0)