Skip to content

Add support for WebView#351

Open
just-some-entity wants to merge 13 commits intoquickshell-mirror:masterfrom
just-some-entity:webview
Open

Add support for WebView#351
just-some-entity wants to merge 13 commits intoquickshell-mirror:masterfrom
just-some-entity:webview

Conversation

@just-some-entity
Copy link

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.

… since webview expects QCoreApplication to atleast have the program name as argument, otherwise aborts leading to a crash in quickshell.
@outfoxxed
Copy link
Member

Changing qArgC is fine but I do not want to force a dependency on qtwebview or qtwebengine. Can we avoid calling initialize?

@just-some-entity
Copy link
Author

According to the docs: (https://doc.qt.io/qt-6/qml-qtwebview-webview.html#details)
To make the Qt WebView module function correctly across all platforms, it is necessary to call QtWebView::initialize() right after creating the QGuiApplicationinstance.

In https://doc.qt.io/qt-6/qtwebview.html they clarify that: This function initializes resources or sets options that are required by the different back-ends.

I tested it both with initialize() and without on my laptop and PC, and observed no visible issues. So it might work. However, there are no guarantees, and using it could lead to hard-to-debug undefined behavior when others start using or distributing configurations with WebView enabled. Since quickshell targets Linux only, I might review the QtWebView source for initialize() and try to implement it directly in qs, assuming the implementation is not too complex. This would avoid the dependency, though we would need to manually keep the code in sync with upstream.

@outfoxxed
Copy link
Member

if the initialization logic is complex, an acceptable solution would be to have a skeleton header with just that static function, and load the module dynamically if a pragma is set.

@just-some-entity
Copy link
Author

Alright. I removed the cmake options and added the pragma. When set to true it now calls the init function in webengine/webengine.hpp which attempts to load the appropriate library and symbol to call QtWebEngineQuick::initialize. Since webengine.hpp is only included by launch.cpp I figured offloading the function to a .cpp was not necessary.

@outfoxxed
Copy link
Member

Looks acceptable, though loading a symbol with a mangled name seems a little iffy https://doc.qt.io/qt-6/qlibrary.html#resolve. Can you add a manual test so we can make sure it still works in the future?

@just-some-entity
Copy link
Author

I agree, but that was the best solution I managed to come up with, and unless they modify the symbol somehow, it should work just fine. Also added a regular test for the init function, unless you meant some other form of test with "manual test"

@kRHYME7
Copy link

kRHYME7 commented Jan 17, 2026

Any update on this one? Thanks!

@outfoxxed
Copy link
Member

Alright so I forgot about this last time because setting up the env to get it loading was annoying, but did that now. Anyway I haven't been able to get it to not immediately crash. If it is actually working for people we can merge this anyway though.

build/src/quickshell -p ../test/webengine.qml
  INFO: Launching config: "/home/admin/programming/outfoxxed/quickshell/test/webengine.qml"
  INFO: Shell ID: "4f1e843a16fb03d1e777938d3f1d5a86" Path ID "4f1e843a16fb03d1e777938d3f1d5a86"
  INFO: Saving logs to "/run/user/1000/quickshell/by-id/9do3mwugbt/log.qslog"
 DEBUG: Loaded library Qt6WebEngineQuick
 DEBUG: Found symbol QtWebEngineQuick::initialize(). Initializing WebEngine...
 DEBUG: Successfully initialized QtWebEngineQuick
  INFO: Configuration Loaded
Received signal 11 SEGV_MAPERR 00000000001a
#0 0x7fdbd0692085 base::debug::CollectStackTrace()
#1 0x7fdbd0677d74 base::debug::StackTrace::StackTrace()
#2 0x7fdbd06927da base::debug::(anonymous namespace)::StackDumpSignalHandler()
#3 0x7fdbde841da0 (/nix/store/j193mfi0f921y0kfs8vjc1znnr45ispv-glibc-2.40-66/lib/libc.so.6+0x41d9f)
#4 0x7fdbd058d965 base::internal::BindStateHolder::IsCancelled()
#5 0x7fdbd061bf75 base::sequence_manager::internal::TaskQueueImpl::RemoveAllCanceledDelayedTasksFromFront()
#6 0x7fdbd062df9c base::sequence_manager::internal::WakeUpQueue::RemoveAllCanceledDelayedTasksFromFront()
#7 0x7fdbd061590c base::sequence_manager::internal::SequenceManagerImpl::GetPendingWakeUp()
#8 0x7fdbd062fc95 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl()
#9 0x7fdbd0630ab2 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork()
#10 0x7fdbcb2cf02a std::_Function_handler<>::_M_invoke()
#11 0x7fdbdf21ed55 QObject::event()
#12 0x7fdbdf1be6a8 QCoreApplication::notifyInternal2()
#13 0x7fdbdf1c1f19 QCoreApplicationPrivate::sendPostedEvents()
#14 0x7fdbdf4fc92f postEventSourceDispatch()
#15 0x7fdbe190182b g_main_context_dispatch_unlocked
#16 0x7fdbe1904e08 g_main_context_iterate_unlocked.isra.0
#17 0x7fdbe19056af g_main_context_iteration
#18 0x7fdbdf4fc10d QEventDispatcherGlib::processEvents()
#19 0x7fdbdf1cc1eb QEventLoop::exec()
#20 0x7fdbdf1c7599 QCoreApplication::exec()
#21 0x559a4c8b5fd0 qs::launch::launch()
#22 0x559a4c8aa8db qs::launch::(anonymous namespace)::launchFromCommand()
#23 0x559a4c8a8735 qs::launch::runCommand()
#24 0x559a4c8a1663 qs::launch::main()
#25 0x7fdbde82a4c5 __libc_start_call_main
#26 0x7fdbde82a578 __libc_start_main_alias_2
#27 0x559a4c89ef45 _start
  r8: 0000000000000000  r9: 0000000000000000 r10: 0000000000000000 r11: 0000000000000000
 r12: 00007fff63b524e0 r13: 00007fff63b524e0 r14: 00007fff63b524e0 r15: 00007fdbacdf6f00
  di: 0000000000000002  si: 0000000000000000  bp: 00007fff63b52050  bx: 00007fdbacdf7e00
  dx: 0000000000000000  ax: 0000000000000000  cx: 0000000000000000  sp: 00007fff63b51a18
  ip: 00007fdbd058d965 efl: 0000000000010246 cgf: 002b000000000033 erf: 0000000000000004
 trp: 000000000000000e msk: 0000000000000000 cr2: 000000000000001a
[end of stack trace]

For

//@ pragma EnableQtWebEngineQuick

import Quickshell
import QtQuick
import QtWebEngine

FloatingWindow {
	WebEngineView {
		anchors.fill: parent
		url: "https://www.qt.io"
	}
}

@WeraPea
Copy link

WeraPea commented Mar 6, 2026

I had run into the same issue, had to compile quickshell without jemalloc to fix it.

@outfoxxed
Copy link
Member

Disabling jemalloc does fix it but we don't want to do that generally. Does QtWebView have the same problem? Any particular reason we're using WebEngine here?

@WeraPea
Copy link

WeraPea commented Mar 7, 2026

QtWebView also crashes for me without jemalloc disabled.

@outfoxxed
Copy link
Member

Unfortunate. Well we can probably merge this off by default.

@acropolis914
Copy link

Are you gonna merge this?

@just-some-entity
Copy link
Author

just-some-entity commented Mar 9, 2026

Since this week I finally have some free time again and will look into the issue myself and additionally the code for webengine over the week to try and determine a possible cause and ideally fix for it. But since this is an optional feature we might for now simply print a warning in the terminal that the feature is currently considered unstable and could crash

mecattaf added a commit to mecattaf/quickshellX that referenced this pull request Mar 15, 2026
…contribution walkthrough

Analysis of upstream PRs quickshell-mirror#566 and quickshell-mirror#351 to understand outfoxxed's review
patterns. Comprehensive quickshell style guide derived from codebase analysis.
Step-by-step walkthrough for contributing fixes to PR quickshell-mirror#351 (WebEngine support).

Key conclusion: no code fork needed — upstream PR quickshell-mirror#351 + spec flag is sufficient.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
mecattaf added a commit to mecattaf/quickshellX that referenced this pull request Mar 15, 2026
mecattaf added a commit to mecattaf/quickshellX that referenced this pull request Mar 15, 2026
@mecattaf
Copy link

Hello just-some-entity,
I've been working on WebEngine integration in my own fork and hit the same jemalloc issue. I can help address the remaining review feedback (style fixes, jemalloc warning, manual test QML). Would you be open to a PR against your webview branch, or would you prefer I post suggestions here?
Thanks,
T

mecattaf pushed a commit to mecattaf/quickshellX that referenced this pull request Mar 16, 2026
Remove build-time WEBENGINE boption, conditional find_package, build.hpp
define, and Qt::WebEngineQuick linking. Replace with runtime QLibrary
dynamic loading via src/webengine/webengine.hpp, matching the upstream-
compatible approach from PR quickshell-mirror#351.

WebEngine loads at runtime only when //@ pragma UseWebEngine is set.
Graceful failure with warning if Qt6WebEngineQuick is not installed.
Moves UseWebEngine pragma to zone 1 for style consistency. Adds unit
test and manual test QML file.

https://claude.ai/code/session_011DHczKfY2JRoYts3UaNmTc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants