Skip to content

fix(hyprland): write window rules Hyprland 0.56 accepts, keep DMS windows opaque - #3655

Merged
bbedward merged 2 commits into
duxlabs-dev:masterfrom
Conava:hyprland-settings
Oct 7, 2026
Merged

bbedward merged 2 commits into
duxlabs-dev:masterfrom
Conava:hyprland-settings

Conversation

@Conava

@Conava Conava commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes window rules on Hyprland 0.56 and stops compositor opacity from dimming DMS's own windows.

The Lua writer emits keys Hyprland 0.56 doesn't know, so the Floating and Pinned match conditions and the No border and No Rounding options do nothing. The same rule written before and after this PR:

-- before
hl.window_rule({ match = { class = "^throwaway$", floating = true, pinned = true }, noborder = true, norounding = true })
-- after
hl.window_rule({ match = { class = "^throwaway$", float = true, pin = true }, border_size = 0, rounding = 0 })

DMS windows already draw their own translucent background (Floating windows → Opacity), so any opacity rule or decoration.*_opacity multiplies on top of it. A user who wants other apps translucent ends up with an unreadable Settings window, and the only workaround is a hand-written rule.

  • Writer emits float/pin, border_size = 0/rounding = 0, and drops initialised (not a Hyprland 0.56 match key). The parser still reads the old spellings, so existing files load and get rewritten on the next save
  • Rule editor on Hyprland no longer shows fields the writer drops: Window Opening output/workspace, Size Constraints, the Initialised match. Save is disabled while only one half of a move or size pair is filled, since the writer needs both
  • Every window-rule write reloads the compositor through one helper; on Hyprland no reload was triggered before
  • A hidden rule for com.danklinux.dms: opaque = true on Hyprland and opacity 1.0 on niri. Hyprland applies opaque after rule and decoration opacity regardless of rule order (checked in the v0.56.2 source) and keeps the window's own translucent background. niri has no equivalent, so the rule is kept as the last one in the file. MangoWC is skipped since DMS writes no opacity there. It's hidden from the rules list and the focused-window menu
  • System & integrations → Hyprland → Layout overrides gets a Window opacity slider for decoration.active_opacity/inactive_opacity. At 100 DMS writes nothing and the user's config applies
  • HyprlandService.reloadConfig queues callbacks. Proc keeps one callback per id, so a second reload while the layout writer's was pending dropped its callback, and gaps, borders and window opacity stopped applying until a restart. The cursor writer could already trigger this; the opaque rule's reload on first start makes it much more likely

One new string: "Window opacity".

A few things worth flagging:

  • The opaque rule is written into the user's window rules file on start whenever it's missing, not only once like the existing DMS floating-window rule, since DMS windows have their own Opacity setting. Happy to gate it if you'd rather not write on start.
  • setDmsWindowFloatingRule became a generic setDmsRule(id, rule, onDone) shared by both DMS-owned rules, with a process id per rule.
  • "Window opacity" sits close to Floating windows → Opacity in meaning. The slider is on the Hyprland page, but if you'd prefer a different label I'll change it.
  • The disabled Save on a half-filled pair has no explanation, to avoid a new string.

Validation

  • Before/after above is the output of dms config windowrules add hyprland from upstream/master and this branch, run against a sandboxed XDG_CONFIG_HOME
  • Tested by hand in a Hyprland 0.56.2 session: new rules leave hyprctl configerrors empty, a rule change applies to new windows without a manual reload, a .* opacity rule dims other apps but not Settings, the slider dims other apps and 100 restores the user's values, and the opaque rule comes back after deleting it from the file and restarting
  • New Go tests: writer key names, parser old/new spellings, rounding/border_size round trip, opaque rule kept last on set/remove/reorder, and end-to-end write → reorder → reload for Hyprland and niri
  • go test ./... (everything except internal/screenshot's TestWaylandOutputBoundsScaled, which also fails on upstream/master on this machine), GOOS=freebsd go build ./..., make lint-qml, make build, python3 quickshell/tests/run-qml.py logic qt lock, settings search index regenerated, prek run on the changed files. Skipped the qml-tests hook (needs niri) and the go-test hook (the screenshot test above)

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

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 any new behaviors: docs: Hyprland window opacity and float rule key dux-docs#153

Copilot AI balanced review requested due to automatic review settings October 2, 2026 14:30

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@bbedward

bbedward commented Oct 2, 2026

Copy link
Copy Markdown
Member

/claude review

@@ -417,7 +415,6 @@ Item {
readonly property var liveRuleData: (root.windowRules || []).find(rule => rule.id === ruleIdRef) ?? modelData

title: liveRuleData.name || liveRuleData.matchCriteria?.appId || liveRuleData.matchCriteria?.title || I18n.tr("Unnamed rule")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This PR removes the titleColor binding, so disabled rules no longer show a dimmed title. Every rule now looks enabled in the list. The removal looks unrelated to this change, so it was probably a rebase/merge leftover. Restore it:

Suggested change
title: liveRuleData.name || liveRuleData.matchCriteria?.appId || liveRuleData.matchCriteria?.title || I18n.tr("Unnamed rule")
title: liveRuleData.name || liveRuleData.matchCriteria?.appId || liveRuleData.matchCriteria?.title || I18n.tr("Unnamed rule")
titleColor: liveRuleData.enabled !== false ? Theme.surfaceText : Theme.surfaceVariantText

@Conava Conava Oct 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This isn't a regression. Every window rule parser sets Enabled: true (hyprland_parser.go, niri_parser.go, mango_parser.go) and nothing in the UI can disable a rule, so the binding never takes effect. I can easily restore it if kept for a future disable toggle

@claude

claude Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Claude review

Looks good overall. One regression to fix before merge.

  • Disabled window rules no longer show a dimmed title because the titleColor binding was removed, quickshell/Modules/Settings/WindowRulesTab.qml:417
    Checked: Lua writer/parser key changes and round trip, opaque rule pinning in store.go, startup ensure/seed flow and setDmsRule refactor, Hyprland reload callback queue, decoration opacity writer, rule editor Hyprland field gating and halfPair, slider visibility, I18n usage. Model: claude-opus-5-5.

@Conava
Conava requested a review from bbedward October 3, 2026 13:31
Conava added 2 commits October 7, 2026 14:04
…dows opaque

The Lua window-rule writer emitted match keys and effects Hyprland 0.56
does not know: `floating`/`pinned`/`initialised` as match keys and
`noborder`/`norounding` as effects. It now writes `float`/`pin` and
`border_size = 0`/`rounding = 0`; the parser still reads the old
spellings, so existing files load and are rewritten on the next save.
"No Rounding" now suppresses the corner radius so a rule has one
`rounding` key.

The rule editor no longer offers fields the Hyprland writer drops
(Window Opening output/workspace, Size Constraints, the Initialised
match), and Save is disabled while only one half of a move or size
pair is filled. Every window-rule write now reloads the compositor
through one helper, which also covers Hyprland.

DMS windows draw their own translucent background, so any compositor
opacity rule or decoration opacity multiplied on top of it. DMS now
keeps a hidden rule for its own app id: `opaque = true` on Hyprland
(applied after rule and decoration opacity, independent of order, and
leaving the window's own alpha alone) and `opacity 1.0` on niri, which
the store keeps last. It is re-added on start when missing and hidden
from the rules list and the focused-window menu.

Compositor layout gains a Hyprland "Window opacity" slider writing
decoration.active_opacity/inactive_opacity; 100 leaves the user's own
config in charge.

HyprlandService.reloadConfig queues callbacks: Proc keeps one callback
per id, so a reload requested while the layout writer's reload was
pending dropped its callback and left layout generation stuck.
Hyprland 0.56's Lua window_rule rejects rounding above 20 ("value 24
is more than the maximum of 20") and the rule loses its rounding. The
Hyprland writer now clamps to 20, and the editor slider stops at 20
for every compositor.
@bbedward

bbedward commented Oct 7, 2026

Copy link
Copy Markdown
Member

/claude review

@claude

claude Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Claude review

Looks good. The new commit makes the change requested in the earlier review comments.
No issues found.
Checked: the corner radius cap commit (Hyprland Lua writer clamps rounding to 20 and is the only place that writes it; the editor slider stops at 20; the new test), on top of the earlier full review of the writer/parser, opaque rule pinning, reload callback queue, opacity slider and editor field gating. The titleColor thread was answered by the author and is not repeated here. Model: claude-opus-5-5.

@bbedward
bbedward merged commit 72c2316 into duxlabs-dev:master Oct 7, 2026
4 checks passed
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