-- Smart gaps hl.workspace_rule({ workspace = "w[tv1]s[false]", gaps_out = 0, gaps_in = 0 }) hl.workspace_rule({ workspace = "f[1]s[false]", gaps_out = 0, gaps_in = 0 }) hl.window_rule({ match = { float = false, workspace = "w[tv1]s[false]" }, border_size = 0 }) hl.window_rule({ match = { float = false, workspace = "f[1]s[false]" }, border_size = 0 }) -- For multiple monitors function map_monitors() local monitor_priority = { ["eDP-1"] = -1 } local monitors = hl.get_monitors() local nmonitors = #monitors table.sort(monitors, function(a, b) return (monitor_priority[a.name] or 0) > (monitor_priority[b.name] or 0) end) local workspace = 9 for i, monitor in ipairs(monitors) do local lower_workspace = workspace + 1 - math.floor(9/nmonitors) if i == nmonitors then lower_workspace = 1 end for j = workspace, lower_workspace, -1 do hl.workspace_rule({workspace = tostring(j), monitor = monitor.name}) end workspace = lower_workspace - 1 end end map_monitors() hl.on('monitor.added', map_monitors) hl.on('monitor.removed', map_monitors) -- Special workspace hl.workspace_rule({ workspace = "s[true]", gaps_out = 64, gaps_in = 12}) -- Misc window rules hl.window_rule({ match = { class = "Write:" }, float = true }) hl.window_rule({ match = { class = "xdg-desktop-portal-gtk" }, float = true }) hl.window_rule({ match = { title = "(Open File)" }, no_blur = true }) hl.window_rule({ match = { class = "(Xdg-desktop-portal-gtk)" }, no_blur = true }) hl.window_rule({ match = { class = "(eog)" }, float = true, center = true }) hl.window_rule({ match = { class = "ninjabrainbot-Main" }, float = true, move = {6, "monitor_h*0.5 - window_h*0.5"} }) hl.window_rule({ match = { class = "(mpv|loupe|com.gabm.satty)" }, float = true, size = { "monitor_w*0.95", "monitor_h*0.95"} }) hl.window_rule({ match = { title = "monoverlay(-t)?" }, float = true, pin = true, no_blur = true, }) hl.window_rule({ match = { title = "monoverlay-t" }, decorate = false, }) hl.layer_rule({ match = { namespace = "quickshell" }, no_anim = true }) hl.on("window.open", function (window, active) if hl.get_active_monitor().active_special_workspace ~= nil then hl.dispatch(hl.dsp.window.move({workspace = hl.get_active_monitor().active_workspace, window = window})) end end) hl.on("window.active", function(window, active) if window == nil or window.class == nil then hl.dispatch(hl.dsp.submap("reset")) return end if window.class:find("zen") == 1 then hl.dispatch(hl.dsp.submap("zen")) elseif window.class:find("Minecraft") == 1 then hl.dispatch(hl.dsp.submap("mcsr")) else hl.dispatch(hl.dsp.submap("reset")) end end) hl.define_submap("zen", function() hl.bind("ALT + ALT_L", hl.dsp.send_key_state({mods = "ALT", key = "F12", state = "down"}), {release = true}) hl.bind("ALT + N", hl.dsp.send_shortcut({mods = "CTRL", key = "TAB"})) hl.bind("ALT + T", hl.dsp.send_shortcut({mods = "CTRL + SHIFT", key = "TAB"})) end)