---------------------
---- WINDOWRULES ----
---------------------
-- Version 1
-- Last change: Sun 2026-06-14 using Hyprland v0.55.3-1
-- Git repo: https://git.fennek.xyz/fennek182/dotfiles

-- See https://wiki.hypr.land/Configuring/Basics/Window-Rules/
-- and https://wiki.hypr.land/Configuring/Basics/Workspace-Rules/

local suppressMaximizeRule = hl.window_rule({
    -- Ignore maximize requests from all apps. You'll probably like this.
    name  = "suppress-maximize-events",
    match = { class = ".*" },

    suppress_event = "maximize",
})
-- suppressMaximizeRule:set_enabled(false)

hl.window_rule({
    -- Fix some dragging issues with XWayland
    name  = "fix-xwayland-drags",
    match = {
        class      = "^$",
        title      = "^$",
        xwayland   = true,
        float      = true,
        fullscreen = false,
        pin        = false,
    },

    no_focus = true,
})

hl.window_rule({
    -- fake fullscreen for chromium
    name  = "chromium-fake-fullscreen",
    match = {
        class      = "chronmium-browser",
    },

    fullscreen_state = 1,
})


-- Layer rules also return a handle.
-- local overlayLayerRule = hl.layer_rule({
--     name  = "no-anim-overlay",
--     match = { namespace = "^my-overlay$" },
--     no_anim = true,
-- })
-- overlayLayerRule:set_enabled(false)




-- TODO: check window rules
-- Hyprland-run windowrule
-- hl.window_rule({
--     name  = "move-hyprland-run",
--     match = { class = "hyprland-run" },

--     move  = "20 monitor_h-120",
--     float = true,
-- })

--- No gaps on fullscreen
-- https://wiki.hyprland.org/Configuring/Workspace-Rules/#smart-gaps
-- To replicate “smart gaps” / “no gaps when only” from other WMs/Compositors, use this bad boy:
hl.workspace_rule({ workspace = "w[tv1]", gaps_out = 0, gaps_in = 0 })
hl.workspace_rule({ workspace = "f[1]", gaps_out = 0, gaps_in = 0 })
hl.window_rule({ match = { float = false, workspace = "w[tv1]" }, border_size = 0 })
hl.window_rule({ match = { float = false, workspace = "w[tv1]" }, rounding = 0 })
hl.window_rule({ match = { float = false, workspace = "f[1]" }, border_size = 0 })
hl.window_rule({ match = { float = false, workspace = "f[1]" }, rounding = 0 })


-- hl.window_rule({
--     name  = "fullscreen_state_1",
--     match = {
--         match = "class chronmium-browser",
--     },
--     -- TODO: review rule: "fullscreen_state 1"
-- })
