Skip to content

fix(kde): plasmoid hidden on Plasma 6 — XHR file:// reads are blocked in Qt 6 - #15

Merged
vdemonchy merged 1 commit into
mainfrom
fix/plasmoid-qt6-xhr-file-read
Jun 10, 2026
Merged

vdemonchy merged 1 commit into
mainfrom
fix/plasmoid-qt6-xhr-file-read

Conversation

@vdemonchy

Copy link
Copy Markdown
Owner

Summary

A Plasma user reported (on r/Gamesir) that the plasmoid hides itself even with a controller connected, and the Lighting config tab always shows "no controller connected".

Root cause: readState() in main.qml and readMode() in ConfigLighting.qml read the daemon state file with XMLHttpRequest on a file:// URL. Qt 6 blocks XHR local-file reads unless QML_XHR_ALLOW_FILE_READ=1 is set, which plasmashell does not set. The XHR completes silently with empty responseText, the catch falls back to { present: false }, and applyStatus() sets HiddenStatus.

Reproduced on Qt 6.9.2:

XMLHttpRequest: Using GET on a local file is disabled by default.
Set QML_XHR_ALLOW_FILE_READ to 1 to enable this feature.

Fix

Replace both XHR readers with a Plasma5Support.DataSource (executable engine) polling cat of the state file — the same mechanism writeConfig() already uses, so this adds no new dependency. The engine's built-in interval replaces the manual Timer. Note plasma5support is a Plasma 6 component (the ported DataEngine framework), despite the name.

Testing

  • Minimal qml6 repro confirms the XHR block on Qt 6.9.2 and that the env var is the only way to lift it.
  • qmllint passes on both files (only pre-existing warnings).
  • A qml6 harness running the exact onNewData handler: file present → ActiveStatus with mode parsed; file missing → HiddenStatus; corrupt JSON → HiddenStatus.
  • cat '<path>' 2>/dev/null verified for both present and missing state file.
  • Not live-tested in a Plasma session (dev machine runs GNOME) — would appreciate confirmation from a Plasma user that both the panel icon and the Lighting tab now work.

🤖 Generated with Claude Code

Qt 6 blocks XMLHttpRequest reads of file:// URLs unless
QML_XHR_ALLOW_FILE_READ=1 is set, which plasmashell does not set. The
XHR completed silently with empty responseText, so the plasmoid fell
back to { present: false }, set HiddenStatus, and hid itself even with
a controller connected; the lighting config tab failed the same way and
always showed "no controller connected".

Replace both XHR readers with a Plasma5Support.DataSource on the
executable engine polling `cat` of the state file — the same mechanism
writeConfig() already uses, so no new dependency. The engine's built-in
interval also replaces the manual Timer. A missing state file (daemon
stopped) exits non-zero with empty stdout, which maps to the existing
{ present: false } fallback.

Reported on Reddit r/Gamesir by a Plasma user after the KDE frontend
release.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added the bug Something isn't working label Jun 10, 2026
@vdemonchy
vdemonchy merged commit 6d16655 into main Jun 10, 2026
1 check passed
@vdemonchy
vdemonchy deleted the fix/plasmoid-qt6-xhr-file-read branch June 10, 2026 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant