Add webkitgtk6 option#4570
Conversation
`webkit_web_view_new_with_user_content_manager` has been removed in webkit-6 so this now has to be done manually.
Gtk4 removed several menu widgets and reworked menu and accelerator interactions.
This just removes some already disabled code and clarifies some comments.
This doesn't fully implement functionality and may fail. See: https://discourse.gnome.org/t/file-drag-and-drop-in-gtkmm4/10548/5
Gtk4 requires an app id. The existing 'ProgramName' app option seems like a good fit for this.
The 'on demand' policy was removed but 'never' should still map to case 2.
|
Caution Review failedAn error occurred during the review process. Please try again later. WalkthroughThis PR splits the Linux frontend into legacy GTK3/WebKit2 (gated linux && !webkit_6) and a new GTK4/WebKit6 path (gated linux && webkit_6), adding full GTK4/WebKit6 implementations for windowing, frontend, menus, clipboard, screen enumeration, keys, and assetserver webview plumbing. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor WebView as C/WebKit
participant CGO as cgo bridge
participant Frontend as Go:frontend_webkit6
participant Dispatcher as frontend.Dispatcher
participant Window as Go/C Window
WebView->>CGO: processMessage / processBindingMessage(C string)
CGO->>Frontend: exported function call
Frontend->>Frontend: validate origin / unmarshal
Frontend->>Dispatcher: dispatch binding or event
Dispatcher->>Window: perform action (show/size/exec)
Window->>CGO: ExecuteOnMainThread / C helpers for UI ops
note right of Frontend `#DDEBF7`: async goroutine dispatch for callbacks and menu clicks
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related issues
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
COD3HUNT3R
left a comment
There was a problem hiding this comment.
Also need changes for doctor command
https://github.com/Sammy-T/wails/tree/feature/webkitgtk6/v2/internal/system/packagemanager
|
@COD3HUNT3R this is intended to work similarly to when using |
Yes, you are right but this would be helpful to find required packages for gtk4, webkit2-6.0 |
|
Had to revert updating from master (ca1eed6) because it broke local development on linux for me. |
|
Running this on X11 Linux Mint, this appears to be working nicely. I still don't know how/if I can get the todos (window positioning, etc.) working with webkit-6 though. @leaanthony Are you able to test this and see how it runs for you? And do you know how to address the commented todos? |
|
Yeah, I don't consider it ideal either. But my intent was to reduce the amount of duplicated files/code where there was little to no change in the Go side of the code. Do you want me to migrate the |
|
I think it might be easier to follow/debug? Might be something an LLM can do reasonably quickly. I'm going to try and get a v2 release out today and will look at including this in the next release. I'll install a fresh linux to test today. |
|
Alright. That's great. I prefer to migrate it myself. But I'll try to get it done soon. |
|
The |
|
Legend! 👍 |
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (14)
v2/internal/frontend/desktop/linux/clipboard.go(1 hunks)v2/internal/frontend/desktop/linux/clipboard_webkit6.go(1 hunks)v2/internal/frontend/desktop/linux/frontend.go(1 hunks)v2/internal/frontend/desktop/linux/frontend_webkit6.go(1 hunks)v2/internal/frontend/desktop/linux/keys.go(1 hunks)v2/internal/frontend/desktop/linux/keys_webkit6.go(1 hunks)v2/internal/frontend/desktop/linux/webkit2.go(1 hunks)v2/internal/frontend/desktop/linux/webkit6.go(1 hunks)v2/pkg/assetserver/webview/request_linux.go(1 hunks)v2/pkg/assetserver/webview/request_linux_webkit6.go(1 hunks)v2/pkg/assetserver/webview/responsewriter_linux.go(1 hunks)v2/pkg/assetserver/webview/responsewriter_linux_webkit6.go(1 hunks)v2/pkg/assetserver/webview/webkit2_36+.go(1 hunks)v2/pkg/assetserver/webview/webkit6.go(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- v2/pkg/assetserver/webview/webkit2_36+.go
🚧 Files skipped from review as they are similar to previous changes (5)
- v2/internal/frontend/desktop/linux/webkit2.go
- v2/pkg/assetserver/webview/responsewriter_linux.go
- v2/pkg/assetserver/webview/request_linux.go
- v2/internal/frontend/desktop/linux/keys.go
- v2/internal/frontend/desktop/linux/clipboard.go
🧰 Additional context used
🧠 Learnings (7)
📓 Common learnings
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:29-30
Timestamp: 2025-08-08T10:25:32.415Z
Learning: For Wails v3 Linux nfpm template, Debian/Ubuntu WebKitGTK runtime package names differ: Debian 12 (Bookworm) uses libwebkit2gtk-4.1-0 while Ubuntu 22.04 (Jammy) uses libwebkit2gtk-4.0-37. Prefer an OR dependency "libwebkit2gtk-4.1-0 | libwebkit2gtk-4.0-37" in v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl to support both.
Learnt from: Sammy-T
Repo: wailsapp/wails PR: 4570
File: v2/internal/frontend/desktop/linux/window_webkit6.go:97-108
Timestamp: 2025-10-17T23:16:11.570Z
Learning: For webkit_6/GTK4 builds in v2/internal/frontend/desktop/linux/window_webkit6.go, GTK widget creation should not be wrapped in invokeOnMainThread. The activation mechanism (activateWg + onActivate export) already handles thread safety, and additional wrapping would cause issues.
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:37-38
Timestamp: 2025-08-08T11:10:17.787Z
Learning: In Wails v3 nfpm templates for RPM (RHEL-family), do not use a boolean OR between webkit2gtk3 and webkit2gtk4.1. Binaries built against WebKitGTK 4.1 are not ABI-compatible with 4.0, so the dependency must be pinned to the exact ABI: use webkit2gtk4.1 for 4.1 builds (e.g., RHEL/Rocky 10) and webkit2gtk3 for 4.0 builds (RHEL/Rocky 8/9).
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:29-30
Timestamp: 2025-08-08T10:25:32.415Z
Learning: Ubuntu 22.04 (Jammy) official repos include both WebKitGTK runtimes: libwebkit2gtk-4.0-37 and libwebkit2gtk-4.1-0 (Universe). For nfpm templates, depend on the exact SONAME matching the built ABI (use libwebkit2gtk-4.1-0 when targeting 4.1; use libwebkit2gtk-4.0-37 when targeting 4.0) rather than an OR across ABIs.
📚 Learning: 2025-10-17T23:16:11.570Z
Learnt from: Sammy-T
Repo: wailsapp/wails PR: 4570
File: v2/internal/frontend/desktop/linux/window_webkit6.go:97-108
Timestamp: 2025-10-17T23:16:11.570Z
Learning: For webkit_6/GTK4 builds in v2/internal/frontend/desktop/linux/window_webkit6.go, GTK widget creation should not be wrapped in invokeOnMainThread. The activation mechanism (activateWg + onActivate export) already handles thread safety, and additional wrapping would cause issues.
Applied to files:
v2/internal/frontend/desktop/linux/frontend.gov2/internal/frontend/desktop/linux/keys_webkit6.gov2/pkg/assetserver/webview/request_linux_webkit6.gov2/pkg/assetserver/webview/responsewriter_linux_webkit6.gov2/internal/frontend/desktop/linux/clipboard_webkit6.gov2/pkg/assetserver/webview/webkit6.gov2/internal/frontend/desktop/linux/webkit6.gov2/internal/frontend/desktop/linux/frontend_webkit6.go
📚 Learning: 2025-08-08T10:25:32.415Z
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:29-30
Timestamp: 2025-08-08T10:25:32.415Z
Learning: For Wails v3 Linux nfpm template, Debian/Ubuntu WebKitGTK runtime package names differ: Debian 12 (Bookworm) uses libwebkit2gtk-4.1-0 while Ubuntu 22.04 (Jammy) uses libwebkit2gtk-4.0-37. Prefer an OR dependency "libwebkit2gtk-4.1-0 | libwebkit2gtk-4.0-37" in v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl to support both.
Applied to files:
v2/internal/frontend/desktop/linux/frontend.gov2/pkg/assetserver/webview/webkit6.gov2/internal/frontend/desktop/linux/webkit6.go
📚 Learning: 2025-08-08T09:13:16.916Z
Learnt from: APshenkin
Repo: wailsapp/wails PR: 4480
File: v2/internal/frontend/desktop/darwin/message.h:17-19
Timestamp: 2025-08-08T09:13:16.916Z
Learning: In Wails v2 bindings origin verification, processBindingMessage intentionally has different signatures across platforms: Darwin includes an isMainFrame bool (WKWebKit provides it), Linux uses two params (message, source) as WebKitGTK doesn’t expose main-frame info there, and Windows handles origin checks in Go via WebView2 sender/args without a C bridge. This divergence is acceptable/expected per maintainer (APshenkin).
Applied to files:
v2/pkg/assetserver/webview/responsewriter_linux_webkit6.gov2/pkg/assetserver/webview/webkit6.gov2/internal/frontend/desktop/linux/webkit6.gov2/internal/frontend/desktop/linux/frontend_webkit6.go
📚 Learning: 2025-08-08T11:10:17.787Z
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:37-38
Timestamp: 2025-08-08T11:10:17.787Z
Learning: In Wails v3 nfpm templates for RPM (RHEL-family), do not use a boolean OR between webkit2gtk3 and webkit2gtk4.1. Binaries built against WebKitGTK 4.1 are not ABI-compatible with 4.0, so the dependency must be pinned to the exact ABI: use webkit2gtk4.1 for 4.1 builds (e.g., RHEL/Rocky 10) and webkit2gtk3 for 4.0 builds (RHEL/Rocky 8/9).
Applied to files:
v2/pkg/assetserver/webview/webkit6.gov2/internal/frontend/desktop/linux/webkit6.go
📚 Learning: 2025-08-08T10:25:32.415Z
Learnt from: Mihara
Repo: wailsapp/wails PR: 4481
File: v3/internal/commands/updatable_build_assets/linux/nfpm/nfpm.yaml.tmpl:29-30
Timestamp: 2025-08-08T10:25:32.415Z
Learning: Ubuntu 22.04 (Jammy) official repos include both WebKitGTK runtimes: libwebkit2gtk-4.0-37 and libwebkit2gtk-4.1-0 (Universe). For nfpm templates, depend on the exact SONAME matching the built ABI (use libwebkit2gtk-4.1-0 when targeting 4.1; use libwebkit2gtk-4.0-37 when targeting 4.0) rather than an OR across ABIs.
Applied to files:
v2/pkg/assetserver/webview/webkit6.gov2/internal/frontend/desktop/linux/webkit6.go
📚 Learning: 2024-09-30T06:13:46.595Z
Learnt from: leaanthony
Repo: wailsapp/wails PR: 3763
File: v3/examples/window/main.go:472-475
Timestamp: 2024-09-30T06:13:46.595Z
Learning: In `v3/examples/window/main.go`, `time.Sleep` is used within a goroutine and does not block the UI thread.
Applied to files:
v2/internal/frontend/desktop/linux/frontend_webkit6.go
🧬 Code graph analysis (5)
v2/internal/frontend/desktop/linux/keys_webkit6.go (1)
v2/pkg/menu/keys/keys.go (5)
Modifier(9-9)ShiftKey(17-17)ControlKey(21-21)CmdOrCtrlKey(13-13)OptionOrAltKey(15-15)
v2/pkg/assetserver/webview/request_linux_webkit6.go (2)
v2/pkg/assetserver/webview/request.go (1)
Request(8-17)v2/pkg/assetserver/webview/responsewriter.go (1)
ResponseWriter(20-25)
v2/internal/frontend/desktop/linux/clipboard_webkit6.go (1)
v2/internal/frontend/desktop/windows/win32/clipboard.go (2)
GetClipboardText(37-75)SetClipboardText(77-143)
v2/internal/frontend/desktop/linux/webkit6.go (1)
v2/pkg/assetserver/webview/webkit6.go (1)
Webkit2MinMinorVersion(23-23)
v2/internal/frontend/desktop/linux/frontend_webkit6.go (6)
v2/pkg/options/options.go (4)
SecondInstanceData(196-199)SingleInstanceLock(190-194)RGBA(111-116)DragAndDrop(201-216)v2/internal/frontend/originvalidator/originValidator.go (2)
OriginValidator(10-12)NewOriginValidator(15-23)v2/pkg/assetserver/assetserver.go (1)
NewAssetServerMainPage(53-59)v2/pkg/assetserver/webview/request.go (1)
Request(8-17)v2/pkg/assetserver/webview/request_linux.go (1)
NewRequest(23-29)v2/pkg/assetserver/webview/request_linux_webkit6.go (1)
NewRequest(21-27)
|
|
@Sammy-T - sorry for the delay in getting to this. Looking at it now along with a port to v3. @COD3HUNT3R - I'll sort out the v3 port, thanks for offering 👍 |
|
|
@leaanthony It's alright. It's not a small PR so I wasn't expecting it to be a quick review. Thanks for getting to it. |
* chore: remove orphaned root-level debris Drops files that accumulated at the repo root and aren't referenced anywhere: - pr_4570.diff (orphaned patch artifact from PR #4570) - test-changelog-extraction.sh, test-ios-compile.sh, test-version-logic.sh (one-off helper scripts; logic that is still needed lives under v3/scripts/ instead) - test-workflow.md (notes file, no longer current) Reduces noise at the repo root and trims surface area before the v3-alpha → master merge. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore: remove abandoned mkdocs-website experiment Deletes the entire `mkdocs-website/` directory. It was an alternative MkDocs-based docs setup, not deployed anywhere (the v3 docs ship from `docs/` via Cloudflare Pages and the v2 docs ship from `website/`), and has been confirmed abandoned. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(workflows): drop auto-label-issues workflow Companion deletion to the master-side PR; retiring the auto-labeller rather than keeping it across both versions. Removing here so the v3-alpha → master merge has no conflict on this file. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(workflows): drop test-nightly-releases and issue-triage-automation Companion deletion to the master-side PR; retiring both ahead of the v3-alpha → master merge so neither file appears in the conflict set. Issue triage is moving to a real agent-driven workflow. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Code review findingsReviewed the full diff. Summary of issues found, roughly by severity: Blockers
High priority
Silent no-ops (functional gaps)These APIs are commented out with no implementation. Callers get no error and silently broken behaviour:
GTK4 did remove direct equivalents for some of these, but workarounds exist (X11 Low priority
Issues 3, 4, 5, 6 (GObject leak, wrong free, stream reads, soup leak) were also present in the v3 port and have been fixed in #5488. Issues 1, 7, 8, 9, 10 were either absent in v3 or already addressed differently. |
|
I addressed most of the numbered items.
@leaanthony, I don't know when I'll be able to properly revisit this code. But, in the meantime, you're plenty welcome to make whatever edits you need. |


Description
This adds an option to run or build an app on Linux using webkitgtk-6.0.
Depends on:
Fixes #3193
Type of change
Important
Features which have been removed/deprecated from webkit or gtk4 have been marked with todos.
If they can be reimplemented, using this library option could potentially match the functionality of the current implementation.
How Has This Been Tested?
Ubuntu 22.04
The performance is usually noticeable on an app with scrolled content or a complex layout.
Running/Building the app with this PR's changes requires:
-tags webkit_6to the WailsdevorbuildcommandWarnings:
New application windows must be added after the GApplication::startup signal has been emitted.Test Configuration
Requires webkitgtk-6 and gtk4.
Checklist:
website/src/pages/changelog.mdxwith details of this PRSummary by CodeRabbit
New Features
Chores