1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-07 22:18:30 -04:00

Feature/split move size hyprland windowrules (#2824)

* windowrules: add split move/size fields for Lua table syntax

* windowrules: remove deprecated Move/Size fields, switch QML to split fields

* fix: use resolved dms binary path in Proc.runCommand

(cherry picked from commit 21eaaef056)
This commit is contained in:
Kilian Mio
2026-07-14 00:30:26 +02:00
committed by bbedward
parent ee7ac9d2bd
commit 039d14c790
17 changed files with 404 additions and 80 deletions
@@ -5,7 +5,6 @@ import (
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"github.com/AvengeMedia/DankMaterialShell/core/internal/windowrules"
@@ -168,7 +167,8 @@ func ConvertMangoRulesToWindowRules(mangoRules []MangoWindowRule) []windowrules.
}
if w, ok := f["width"]; ok {
if h, ok2 := f["height"]; ok2 {
actions.Size = w + "x" + h
actions.SizeWidth = w
actions.SizeHeight = h
}
}
@@ -200,11 +200,9 @@ func formatMangoRule(rule windowrules.WindowRule) string {
add("tags", rule.Actions.Workspace)
add("monitor", rule.Actions.Monitor)
if rule.Actions.Size != "" {
if w, h, ok := splitSize(rule.Actions.Size); ok {
add("width", w)
add("height", h)
}
if rule.Actions.SizeWidth != "" && rule.Actions.SizeHeight != "" {
add("width", rule.Actions.SizeWidth)
add("height", rule.Actions.SizeHeight)
}
addBool := func(k string, b *bool) {
@@ -223,19 +221,6 @@ func formatMangoRule(rule windowrules.WindowRule) string {
return "windowrule=" + strings.Join(parts, ",")
}
func splitSize(size string) (w, h string, ok bool) {
for _, sep := range []string{"x", "X", " "} {
if parts := strings.Split(size, sep); len(parts) == 2 {
w = strings.TrimSpace(parts[0])
h = strings.TrimSpace(parts[1])
if _, err := strconv.ParseFloat(w, 64); err == nil {
return w, h, true
}
}
}
return "", "", false
}
type MangoWritableProvider struct {
configDir string
}