Lua workspace rule to open special workspace only on specific monitor?

Lately on CachyOS I’m trying to get used to using Yazi for my file manager to further distance myself from the Windows way of doing things and so far I’m quite liking it. What I’m trying to do now is to have Kitty/Yazi open in a special workspace on a specific monitor. So far, I have it opening in the special workspace perfectly, but it will always open on whichever monitor my mouse is currently on.

Relevant sections of my config at the moment:

hl.on("hyprland.start", function ()

hl.exec_cmd("[workspace special:yazi silent] kitty yazi"



hl.bind(mainMod .. " + N", hl.dsp.workspace.toggle_special("yazi"))



hl.workspace_rule({ workspace = "1", monitor = "DP-1" })
hl.workspace_rule({ workspace = "2", monitor = "DP-2" })



hl.workspace_rule({
workspace = "special:yazi",
monitor = "DP-2"
})

It would seem that it’s the last section specifying the workspace rule, but I’m just not figuring out what is wrong.

You could have a window rule that would make yazi always open on the special:yazi workspace. Example with Element:

hl.window_rule({
    name = "element-to-special",
    match = {
        class = "^(Element)$",
    },

    workspace = "special:magic",
})

And since you have

hl.workspace_rule({
workspace = "special:yazi",
monitor = "DP-2"
})

It will always open on that monitor. That being said, once you’re on monitor2 and toggle the special workspace it will not stay on monitor1. Not sure if that’s possible.