1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 07:22:50 -05:00

niri: add window-rule management

- settings UI for creating, editing, deleting window ruels
- IPC to create a window rule for the currently focused toplevel

fixes #1292
This commit is contained in:
bbedward
2026-01-27 19:28:13 -05:00
parent 6557d66f94
commit 68159b5c41
21 changed files with 4576 additions and 5 deletions

View File

@@ -14,12 +14,22 @@ Singleton {
readonly property string outputsPath: hyprDmsDir + "/outputs.conf"
readonly property string layoutPath: hyprDmsDir + "/layout.conf"
readonly property string cursorPath: hyprDmsDir + "/cursor.conf"
readonly property string windowrulesPath: hyprDmsDir + "/windowrules.conf"
property int _lastGapValue: -1
Component.onCompleted: {
if (CompositorService.isHyprland)
if (CompositorService.isHyprland) {
Qt.callLater(generateLayoutConfig);
ensureWindowrulesConfig();
}
}
function ensureWindowrulesConfig() {
Proc.runCommand("hypr-ensure-windowrules", ["sh", "-c", `mkdir -p "${hyprDmsDir}" && [ ! -f "${windowrulesPath}" ] && touch "${windowrulesPath}" || true`], (output, exitCode) => {
if (exitCode !== 0)
console.warn("HyprlandService: Failed to ensure windowrules.conf:", output);
});
}
Connections {

View File

@@ -52,6 +52,10 @@ Singleton {
root.allWorkspaces = Object.values(newMap).sort((a, b) => a.idx - b.idx);
}
function validate() {
validateProcess.running = true;
}
Component.onCompleted: fetchOutputs()
Timer {
@@ -193,6 +197,16 @@ Singleton {
}
}
Process {
id: ensureWindowrulesProcess
property string windowrulesPath: ""
onExited: exitCode => {
if (exitCode !== 0)
console.warn("NiriService: Failed to ensure windowrules.kdl, exit code:", exitCode);
}
}
DankSocket {
id: eventStreamSocket
path: root.socketPath
@@ -1142,6 +1156,11 @@ Singleton {
ensureCursorProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && [ ! -f "${cursorPath}" ] && touch "${cursorPath}" || true`];
ensureCursorProcess.running = true;
const windowrulesPath = niriDmsDir + "/windowrules.kdl";
ensureWindowrulesProcess.windowrulesPath = windowrulesPath;
ensureWindowrulesProcess.command = ["sh", "-c", `mkdir -p "${niriDmsDir}" && [ ! -f "${windowrulesPath}" ] && touch "${windowrulesPath}" || true`];
ensureWindowrulesProcess.running = true;
configGenerationPending = false;
}

View File

@@ -33,6 +33,7 @@ Singleton {
property var polkitAuthModalLoader: null
property var bluetoothPairingModal: null
property var networkInfoModal: null
property var windowRuleModalLoader: null
property var notepadSlideouts: []