Skip to content

feat(theme): support qtengine as a Qt platform theme - #3019

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
Conava:qtengine-platform-theme
Aug 17, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
Conava:qtengine-platform-theme

Conversation

@Conava

@Conava Conava commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds qtengine as a supported Qt platform theme alongside qt5ct, qt6ct and gtk3.

Both existing Qt6 options have problems. qt6ct has multiple unfixed QMenu size/position bugs filed against the trialuser/qt6ct fork, and the AUR qt6ct-kde package the settings UI recommends builds from that same fork. gtk3 only half-themes: DMS's GTK template writes libadwaita variable names (window_bg_color, accent_bg_color, …) and none of the classic theme_bg_color/theme_fg_color names the gtk3 platform theme reads, so Qt6 apps get dark mode and icons but never the matugen accent.

qtengine serves both Qt5 and Qt6 from one JSON config and reads a KDE .colors scheme by path — which the kcolorscheme template already generates, so no new matugen template is needed.

  • Merges theme.colorScheme and theme.iconTheme into $XDG_CONFIG_HOME/qtengine/config.json after each generation, on icon-theme changes, and from Apply Qt Colors. Preserves style, font, fontFixed, misc and unknown keys; refuses a config it can't parse; only names a scheme that exists. The write is atomic, and its mtime bump is what repaints running apps
  • Accepts QT_QPA_PLATFORMTHEME=qtengine in the missing-env-var guard, and rewords three copy sites so the qt6ct-kde caveat attaches to qt6ct rather than reading as a blanket Qt requirement
  • Fixes Apply Qt Colors on qtengine-only machines, where scripts/qt.sh exits 1 without qt5ct or qt6ct so the button always failed. qt.sh is unchanged
  • Adds a dms doctor check that asks qmake/qtpaths where Qt looks for plugins, per Qt major. A file system search would report OK on the packaging bug it exists to catch, where the Qt5 plugin lands under a prefix Qt5 doesn't search
  • New matugenTemplateQtengine setting, default true like its siblings

Every write path is gated on QT_QPA_PLATFORMTHEME/_QT6 being exactly qtengine, and Qt never auto-selects a platform-theme plugin, so users on anything else see no new files and no behavior change.

Validation

Measured on Arch, qtengine 0.2.1, Qt 5.15.19 and 6.11.1. A QApplication built offscreen under each binding, reading the resulting QPalette:

Window colour style icon theme
Qt5, no platform theme 239,239,239 fusion (none)
Qt6, no platform theme 239,239,239 fusion (none)
Qt5, qtengine 15,20,23 qtengine Papirus-Dark
Qt6, qtengine 15,20,23 qtengine Papirus-Dark

15,20,23 is exactly Colors:Window/BackgroundNormal from the generated .colors file.

The merge against a handwritten config with style, both font blocks, misc and an unknown top-level key is key-order-canonicalized, so only real changes show:

   "theme": {
-    "colorScheme": "~/.local/share/color-schemes/SomeOtherScheme.colors",
+    "colorScheme": "/home/user/.local/share/color-schemes/DankMatugen.colors",
     "font": { "family": "Cantarell", "size": 10, "weight": -1 },
     "fontFixed": { "family": "CaskaydiaCove Nerd Font Mono", "size": 9, "weight": -1 },
-    "iconTheme": "breeze-dark",
+    "iconTheme": "Papirus-Dark",
     "style": "Fusion"
   }
  • Malformed JSON at the config path: generation completes, file byte-identical afterward, warning logged
  • --skip-templates qtengine and QT_QPA_PLATFORMTHEME=gtk3: nothing written, no qtengine/ directory created
  • Doctor check: ok for Qt5 and Qt6 here, warn for Qt5 against a tree replicating the AUR layout without the workaround symlink
  • Ran the shell against this branch: icon-theme changes reached qtengine immediately, style/fonts/misc untouched in my real config
  • make fmt, go mod tidy, make test, make build, make lint-qml, GOOS=freebsd go build ./...

Known limitations: Go sorts map keys, so a handwritten config is alphabetized once on first write. os.Rename replaces a symlinked config.json with a regular file, which is deliberate — an in-place truncate risks qtengine reading a half-written file. And buildOnce() returns early when the palette is unchanged, so re-applying an identical color won't recreate a deleted config; the icon-theme path and Apply Qt Colors both run unconditionally and cover that.
One thing to flag about this change itself: I write the qtengine config to opts.ConfigDir, which makes it the only writer in internal/matugen that honours --config-dir. Everything else resolves through the XDG helpers ( substituteVars for all template output, plus configDirExists and refreshQt6ct) so opts.ConfigDir is otherwise a read-only path and --config-dir doesn't actually redirect anything. I went with the flag's stated meaning, but happy to switch to utils.XDGConfigHome() for consistency if you'd rather keep the two aligned.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that changes existing behavior)
  • Refactor / internal cleanup
  • Documentation
  • Other

Related issues

None.

Screenshots / video

screenshot_2026-08-08_12-16-01 screenshot_2026-08-08_12-14-35

Checklist

  • My code follows the conventions in CONTRIBUTING.md
  • I have tested my changes locally
  • New user-facing strings are wrapped in I18n.tr() with translator context, reusing existing terms where possible
  • Go changes: ran make fmt, added/updated tests, make test passes, and go mod tidy is clean
  • QML changes: ran make lint-qml with no new warnings
  • I have opened a corresponding pull request in dlx-docs to document the new behavior: docs(dms): document qtengine as a Qt platform theme option dux-docs#128

Copilot AI lite review requested due to automatic review settings August 8, 2026 11:06

Copilot AI 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.

Pull request overview

Adds qtengine as an additional supported Qt platform theme option, integrating it into both the UI and the matugen/doctor tooling so Qt5/Qt6 apps can pick up the generated KDE .colors scheme and icon theme consistently.

Changes:

  • Adds qtengine config syncing (atomic JSON merge/write) and a dms matugen qtengine subcommand to trigger it.
  • Updates Settings UI + search index to expose matugenTemplateQtengine, adjust guidance strings, and treat QT_QPA_PLATFORMTHEME=qtengine as valid.
  • Extends dms doctor with a Qt plugin-path based check to verify the qtengine platformtheme plugin is installed where Qt actually searches.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
quickshell/translations/settings_search_index.json Adds a searchable settings entry for the new qtengine template toggle.
quickshell/Modules/Settings/ThemeColorsTab.qml Adds qtengine template toggle row and updates missing-env-var/help text to include qtengine.
quickshell/Common/Theme.qml Updates template skipping to include qtengine and extends “Apply Qt Colors” to also sync qtengine config.
quickshell/Common/SettingsData.qml Adds qtengineActive detection, new matugenTemplateQtengine setting, and icon-theme sync hook for qtengine.
quickshell/Common/settings/SettingsSpec.js Registers matugenTemplateQtengine with default true.
core/internal/matugen/qtengine.go Implements qtengine config merge + atomic write and env-var detection helpers.
core/internal/matugen/matugen.go Hooks qtengine sync into generation flow and adds qtengine detection entry for UI template detection.
core/internal/matugen/matugen_test.go Adds unit tests for qtengine env detection, config merge semantics, mtime bumping, and template detection entry.
core/cmd/dms/commands_matugen.go Adds dms matugen qtengine command + flags to run the sync directly.
core/cmd/dms/commands_doctor.go Adds qtengine plugin install verification based on Qt-reported plugin paths.
core/cmd/dms/commands_doctor_test.go Adds focused tests for robust Qt query output parsing.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread core/internal/matugen/qtengine.go Outdated
Comment on lines +36 to +38
func SyncQtengineConfig(configDir, iconTheme string) error {
path := QtengineConfigPath(configDir)

Conava and others added 2 commits August 17, 2026 13:13
qtengine is a single platform theme plugin serving both Qt5 and Qt6 from one JSON config, so it needs neither the qt5ct/qt6ct split nor qt6ct-kde.
It reads a KDE .colors scheme by path, which the kcolorscheme template already generates, so no new matugen template is required.

DMS now merges theme.colorScheme and theme.iconTheme into $XDG_CONFIG_HOME/qtengine/config.json after each generate, on icon theme changes, and from Apply Qt Colors.
The merge preserves every other key,refuses to touch a config it cannot parse, and only names a color scheme that exists.
The write is atomic, and its mtime bump is what trips qtengine's watcher and repaints running apps.

QT_QPA_PLATFORMTHEME=qtengine is accepted without the missing-env-var toast, Apply Qt Colors no longer fails on a machine without qt5ct or qt6ct, and dms doctor reports whether the plugin is installed where Qt actually searches, per Qt major.
@bbedward
bbedward force-pushed the qtengine-platform-theme branch from 6db61b4 to c83a92e Compare August 17, 2026 17:17
@bbedward
bbedward merged commit a56360d into duxlabs-dev:master Aug 17, 2026
3 checks passed
@Conava
Conava deleted the qtengine-platform-theme branch August 17, 2026 19:50
by-architect pushed a commit to by-architect/Phoenix that referenced this pull request Aug 19, 2026
* feat(theme): support qtengine as a Qt platform theme

qtengine is a single platform theme plugin serving both Qt5 and Qt6 from one JSON config, so it needs neither the qt5ct/qt6ct split nor qt6ct-kde.
It reads a KDE .colors scheme by path, which the kcolorscheme template already generates, so no new matugen template is required.

DMS now merges theme.colorScheme and theme.iconTheme into $XDG_CONFIG_HOME/qtengine/config.json after each generate, on icon theme changes, and from Apply Qt Colors.
The merge preserves every other key,refuses to touch a config it cannot parse, and only names a color scheme that exists.
The write is atomic, and its mtime bump is what trips qtengine's watcher and repaints running apps.

QT_QPA_PLATFORMTHEME=qtengine is accepted without the missing-env-var toast, Apply Qt Colors no longer fails on a machine without qt5ct or qt6ct, and dms doctor reports whether the plugin is installed where Qt actually searches, per Qt major.

* fix(theme): resolve qtengine config via XDG, tighten doctor probing

---------

Co-authored-by: bbedward <[email protected]>
marcusramberg pushed a commit to marcusramberg/DankMaterialShell that referenced this pull request Sep 2, 2026
* feat(theme): support qtengine as a Qt platform theme

qtengine is a single platform theme plugin serving both Qt5 and Qt6 from one JSON config, so it needs neither the qt5ct/qt6ct split nor qt6ct-kde.
It reads a KDE .colors scheme by path, which the kcolorscheme template already generates, so no new matugen template is required.

DMS now merges theme.colorScheme and theme.iconTheme into $XDG_CONFIG_HOME/qtengine/config.json after each generate, on icon theme changes, and from Apply Qt Colors.
The merge preserves every other key,refuses to touch a config it cannot parse, and only names a color scheme that exists.
The write is atomic, and its mtime bump is what trips qtengine's watcher and repaints running apps.

QT_QPA_PLATFORMTHEME=qtengine is accepted without the missing-env-var toast, Apply Qt Colors no longer fails on a machine without qt5ct or qt6ct, and dms doctor reports whether the plugin is installed where Qt actually searches, per Qt major.

* fix(theme): resolve qtengine config via XDG, tighten doctor probing

---------

Co-authored-by: bbedward <[email protected]>
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.

3 participants