Skip to content

feat(linux): add WebKitGTK spellcheck options#5087

Open
arcofs wants to merge 1 commit intowailsapp:masterfrom
arcofs:feature/linux-spellcheck-3534
Open

feat(linux): add WebKitGTK spellcheck options#5087
arcofs wants to merge 1 commit intowailsapp:masterfrom
arcofs:feature/linux-spellcheck-3534

Conversation

@arcofs
Copy link
Copy Markdown

@arcofs arcofs commented Mar 27, 2026

Summary

Add Linux WebKitGTK spellcheck support to Wails v2 by exposing spellcheck settings through options.Linux and wiring them into the WebKit web context.

Problem

Wails currently exposes the browser default context menu, but on Linux there is no way for an app to explicitly enable WebKitGTK spellchecking or set spellcheck languages. For editors built on contenteditable or <textarea spellcheck>, this prevents native misspelling underlines and spelling suggestions from working reliably.

This addresses #3534.

Changes

  • add SpellCheckEnabled bool to options.Linux
  • add SpellCheckLanguages []string to options.Linux
  • pass those options through the Linux desktop frontend
  • call webkit_web_context_set_spell_checking_enabled()
  • call webkit_web_context_set_spell_checking_languages() when languages are provided

Scope

This PR only changes the Linux WebKitGTK implementation. It does not add Windows or macOS spellcheck support.

Validation

Used this patch from a downstream Wails app and confirmed:

  • native misspelling squiggles appear in the editor
  • right-click spelling suggestions appear in the native context menu
  • downstream app still passes go test ./...
  • downstream app still builds successfully on Linux with wails build

Notes

Language handling is intentionally minimal here: Wails accepts a list of language tags and passes them straight to WebKitGTK after filtering empty values.

Summary by CodeRabbit

  • New Features
    • Added spell-check configuration options for Linux desktop users. Users can now enable or disable spell checking on editable web content and specify preferred spell-check languages.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d2210a3-8809-4658-b07b-86e9bf16c741

📥 Commits

Reviewing files that changed from the base of the PR and between ebe9d32 and 01d9ebd.

📒 Files selected for processing (4)
  • v2/internal/frontend/desktop/linux/window.c
  • v2/internal/frontend/desktop/linux/window.go
  • v2/internal/frontend/desktop/linux/window.h
  • v2/pkg/options/linux/linux.go

📝 Walkthrough

Walkthrough

The pull request adds spell-check configuration support to the Linux desktop frontend. It introduces two new configuration options to the Linux Options struct, threads them through the Go window initialization layer, and implements WebKit spell-checking enablement in the C window setup code.

Changes

Cohort / File(s) Summary
Spell-Check Configuration
v2/pkg/options/linux/linux.go
Added SpellCheckEnabled bool and SpellCheckLanguages []string fields to the Linux Options struct.
WebView Implementation
v2/internal/frontend/desktop/linux/window.c, v2/internal/frontend/desktop/linux/window.h
Updated SetupWebview function signature and implementation to accept spell-check parameters. C code enables spell checking via WebKit APIs, parses CSV language string, and applies language preferences.
Window Initialization Bridge
v2/internal/frontend/desktop/linux/window.go
Modified NewWindow to extract spell-check configuration from Linux options, process language list into CSV format, allocate C string, and pass both parameters to C SetupWebview call.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 With nibbled quill and twitching nose,
We add the spellcheck feature—oh, how it grows!
From options deep to WebKit's care,
Languages parsed with bundled flair,
The Linux folk shall type so right,
No misspelled words throughout the night!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is comprehensive and includes summary, problem statement, changes, scope, and validation, but is missing required template sections like 'Type of change' checklist and 'How Has This Been Tested?' section. Fill in the required template sections: mark the 'Type of change' as 'New feature', describe the testing performed and environment, and complete the pre-submission checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding WebKitGTK spellcheck options for Linux.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

🔧 OpenGrep (1.16.5)
v2/internal/frontend/desktop/linux/window.c

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m

v2/internal/frontend/desktop/linux/window.go

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m

v2/internal/frontend/desktop/linux/window.h

┌──────────────┐
│ Opengrep CLI │
└──────────────┘

�[32m✔�[39m �[1mOpengrep OSS�[0m
�[32m✔�[39m Basic security coverage for first-party code vulnerabilities.

�[1m Loading rules from local config...�[0m

  • 1 others

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant