Skip to content

Fix dead GUI on Windows: serve UI over HTTP and prefer the Qt backend - #80

Closed
kienbb wants to merge 1 commit into
D-Ogi:mainfrom
kienbb:fix/windows-webview2-js-api-bridge
Closed

kienbb wants to merge 1 commit into
D-Ogi:mainfrom
kienbb:fix/windows-webview2-js-api-bridge

Conversation

@kienbb

@kienbb kienbb commented Jul 30, 2026 •

Copy link
Copy Markdown

On Windows the GUI opens but is completely inert: every button does nothing, the status bar stays on CUDA: OFF / FFMPEG: OFF / RAM: 0%, and no translation ever loads (only the hardcoded English fallbacks show). The CLI (remwm.py) works fine — this is GUI-only.

There are two independent causes, and both have to be fixed for the GUI to work.

1. The UI is loaded from a file:// URL

remwmgui.py passes ui/index.html to create_window(), so the page runs on a file:// origin. pywebview 5+ does not expose the js_api bridge to file:// pages, and Chromium blocks fetch() there too — which is also why ui/config.json and ui/lang/*.json never load, leaving t = {}.

I instrumented every js_api method with a logging wrapper and launched the app. Over 25 seconds, not a single call arrived from JS — only the set_window() call made from Python:

[  0.01s] start http=False pywebview=6.2.1
[  0.01s] CALL set_window args=(<webview.window.Window object ...>,)
[  0.01s]   -> set_window OK None

Serving the same page through pywebview's built-in HTTP server (http_server=True) fixes both the bridge and fetch():

[ 21.69s] CALL get_config           -> OK {}
[ 21.96s] CALL get_dynamic_info     -> OK {'ram_percent': 48.6, ...}
[ 22.18s] CALL get_static_info      -> OK {'cuda': True, 'gpu_name': 'NVIDIA GeForce RTX 3050', 'ffmpeg': True}
[ 22.24s] CALL save_config          -> OK None

2. The WebView2 backend wires up the bridge only about half the time

Even over HTTP, cold launches are a coin flip: the window renders but never connects, and some launches hang the UI thread outright (Not Responding). Counting healthy launches (bridge alive, get_static_info returning cuda: True):

backend healthy launches
WebView2 (pywebview 6.2.1, current default on Windows) 4 / 8
pywebview 5.4 (tried as a downgrade, both file:// and HTTP) 0 / 6
Qt / QtWebEngine (pywebview 6.2.1) 7 / 7

So this PR prefers the Qt backend on Windows when PySide6 is importable, and silently falls back to the previous behaviour when it is not — nothing changes for Linux/macOS, where the GTK/Cocoa backends are already reliable.

Changes

  • remwmgui.py: webview.start(http_server=True, gui=gui), with gui='qt' chosen on win32 when PySide6 is available.

  • requirements.txt: add PySide6; sys_platform == "win32".

  • requirements.txt: mark PyGObject as sys_platform == "linux". On Windows it can never install — the embedded Python from setup.ps1 ships no libs/python312.lib, and it also needs GTK/girepository via MSYS2:

    Could not find Python3 library '...\python\libs\python312.lib'
    Run-time dependency python found: NO (tried pkgconfig and sysconfig)
    ..\meson.build:28:20: ERROR: Python dependency not found
    

    Nothing in the codebase imports gi, so this only ever broke Windows installs.

Verification

Windows 11, RTX 3050, embedded Python 3.12.7 from setup.ps1, pywebview 6.2.1.

After the fix, reading the live page state:

{
  "alpineLoaded": true, "tailwindLoaded": true, "apiMethods": 12,
  "isLoading": false, "translationKeys": 13,
  "systemInfo": { "cuda": true, "gpu": "NVIDIA GeForce RTX 3050", "ffmpeg": true, "ram": 44 }
}

Four consecutive run.bat launches were all healthy, and clicking Start Processing in the GUI ran a file end to end (Done! File processed successfully.) with the watermark removed. Video mode was also checked separately via the CLI: two-pass detection over 24 frames, audio stream preserved through FFmpeg.

Note

One thing I did not touch, but worth flagging: ui/index.html loads Tailwind, Alpine.js and Google Fonts from CDNs at startup (lines 9–14), so the GUI currently needs internet access to render. Vendoring those two scripts would make it work offline — happy to do that in a separate PR if you want it.

Summary by CodeRabbit

  • Improvements
    • Windows installations now prefer the Qt-based web view when available, providing a more consistent in-app browsing experience.
    • Webview startup now uses a local HTTP server, improving compatibility when loading application content.
    • Platform-specific setup has been refined to select the appropriate webview and graphical components for Windows and Linux systems.

On Windows the GUI opened but was completely inert: every button did
nothing, the status bar was stuck on "CUDA: OFF" and no translation ever
loaded. Two independent causes, both needed fixing.

1. The UI is loaded from a file:// URL. pywebview 5+ does not expose the
   js_api bridge to file:// pages, and Chromium blocks fetch() there too,
   so ui/config.json and ui/lang/*.json never loaded either. Tracing every
   js_api method showed zero calls arriving from JS over 25s. Serving the
   same page through pywebview's local HTTP server fixes both.

2. Even over HTTP, the default WebView2 backend wires up the bridge only
   about half the time. Measured over repeated cold launches: WebView2
   4/8 runs healthy (the rest render the page but never connect, some
   hanging the UI thread outright), pywebview 5.4 0/6, Qt backend 7/7.
   So prefer the Qt backend on Windows when PySide6 is available, and
   fall back to the previous behaviour when it is not.

requirements.txt: add PySide6 on Windows for the Qt backend, and mark
PyGObject as Linux-only - it needs GTK/girepository plus Python dev libs,
which the embedded Python from setup.ps1 does not ship, so it always
fails there.

Verified on Windows 11 with an RTX 3050: status bar reports CUDA/FFmpeg
on, config and translations load, and Start Processing runs a file end to
end from the GUI.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@soemon-afk soemon-afk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested the commit and UI is working on Windows 11

@soemon-afk soemon-afk left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested the commit and UI is working on Windows 11

@D-Ogi

D-Ogi commented Sep 16, 2026

Copy link
Copy Markdown
Owner

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 05cc99ff-7838-4e1a-9041-38bd64d23be5

📥 Commits

Reviewing files that changed from the base of the PR and between 2a15d4d and d3ee7c7.

📒 Files selected for processing (2)
  • remwmgui.py
  • requirements.txt

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The application now prefers the Qt WebView backend on Windows when PySide6 is available. Webview startup enables the local HTTP server. Dependency markers limit PySide6 to Windows and PyGObject to Linux.

Changes

WebView platform support

Layer / File(s) Summary
Backend selection and platform dependencies
remwmgui.py, requirements.txt
Windows startup selects the Qt backend when PySide6 is importable and starts pywebview with http_server=True. Requirements add Windows-only PySide6 and restrict PyGObject to Linux.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: soemon-afk

Merge Risk: ⚪ Minimal · up to d3ee7

The Windows WebView startup and platform-specific dependencies are aligned, with no identified merge-blocking impact.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main Windows GUI fix: serving the UI over HTTP and preferring the Qt backend.
Description check ✅ Passed The description is mostly complete. It explains the Windows failure, affected platforms, compatibility changes, implementation details, and validation results. It does not reproduce the template's val…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@D-Ogi

D-Ogi commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Superseded by merged #90. Thank you @kienbb for diagnosing the Windows bridge issue and testing the local HTTP + Qt backend approach. That direction is incorporated into the current dependency stack, with native file/folder dialog checks, real processing and preview tests, and desktop CI on Windows, Linux and macOS. Closing this PR as the implementation is now in main.

@D-Ogi D-Ogi closed this Sep 16, 2026
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.

4 participants