fixed hyprland issue

This commit is contained in:
ari committed 2026-10-19 23:36:47 -04:00
1 parent d42e24be81
commit b127fc2256
2 files changed
+18 -3

No files matched your search

+16 -1
View File
@@ -151,10 +151,16 @@ Item {
return;
const idText = String(id);
// Hyprland has no "clear name", so fall back to the numeric id.
root.runAll([["hyprctl", "dispatch", "renameworkspace", idText, name.length > 0 ? name : idText]]);
const label = name.length > 0 ? name : idText;
root.runAll([["hyprctl", "dispatch", "hl.dsp.workspace.rename({ workspace = " + idText + ", name = " + root.luaString(label) + " })"]]);
}
}
// Quote a string for a Lua expression (Hyprland 0.55+ takes Lua).
function luaString(text: string): string {
return "\"" + text.replace(/[\r\n]+/g, " ").replace(/[\\"]/g, "\\$&") + "\"";
}
function runAll(commands): void {
root.actionQueue = root.actionQueue.concat(commands);
if (!action.running)
@@ -213,6 +219,15 @@ Item {
onExited: root.runNext()
// hyprctl prints its errors on stdout and says "ok" on success.
stdout: StdioCollector {
onStreamFinished: {
const text = this.text.trim();
if (text.length > 0 && text !== "ok")
console.warn("workspace-badge:", text);
}
}
stderr: StdioCollector {
onStreamFinished: {
if (this.text.trim().length > 0)
+2 -2
View File
@@ -424,7 +424,7 @@ Item {
if (root.kind === "niri")
action.command = ["niri", "msg", "action", "focus-window", "--id", key];
else if (root.kind === "hyprland")
action.command = ["hyprctl", "dispatch", "focuswindow", "address:" + key];
action.command = ["hyprctl", "dispatch", "hl.dsp.focus({ window = \"address:" + key + "\" })"];
else
return;
action.running = false;
@@ -464,7 +464,7 @@ Item {
} else if (root.kind === "hyprland") {
if (id < 0)
return;
root.focusQueue = [["hyprctl", "dispatch", "workspace", String(id)]];
root.focusQueue = [["hyprctl", "dispatch", "hl.dsp.focus({ workspace = \"" + String(id) + "\" })"]];
} else {
return;
}