Skip to content

[Snowcap] window:set_geometry() rule breaks borders #437

@litvinov-git

Description

@litvinov-git

Describe the bug

very apparent on the screenshot:

Image

moving it manually with the default mouse bind immediately fixes the border, but not having to do that is very important for scratchpad automation

decorating only after set_geometry fixes it as well, but it would be good to have the freedom to use set_geometry after creation (Edit: sometimes that still doesnt help)

also, the problem of clients ignoring the rules( some clients ignore set_geometry completely.

i think it would be great to have an option to completely ignore all resizing requests from clients

Reproduction steps

configuration as below, press the keybind

Relevant parts of config

    local function center(window, wsize)
        local geo = {}
        local msize = window:output():logical_size()
        geo.x = msize.width / 2 - wsize.width / 2
        geo.width = wsize.width
        geo.y = msize.height / 2 - wsize.height / 2
        geo.height = wsize.height
        window:set_geometry(geo)
    end

    local special_tag_names = { "chatgpt", "whatsapp", "telegram" }
    local special_tags = Tag.add(Output.get_focused(), special_tag_names)
    local function toggle_special(name)
        local current_output = Output.get_focused()
        local tag = Tag.get(name)
        if tag:output():serial() ~= current_output:serial() then
            tag:move_to_output(current_output)
        end
        tag:switch_to()
        if #tag:windows() == 0 then
            Process.spawn("/home/vlitvinov/webapps/" .. name .. ".sh")
            tag:windows()[1]:set_floating(true)
        end
    end

    Input.keybind({ "alt" }, "z", function()
        toggle_special("whatsapp")
    end, {
        group = "Tag",
        description = "WhatsApp"
    })

    local function my_border(window)
        local proto = getmetatable(Snowcap.integration.focus_border(window)).__index

        local border = {
            window = window,
            thickness = 2,
            focused_color = from_hex("#b1acdb"),
            unfocused_color = Widget.color.from_rgba(0.15, 0.15, 0.15),
            focused = window:focused(),
            include_titlebar = false,
            title = "",
            titlebar_height = 0,
        }
        setmetatable(border, { __index = proto })
        return border
    end


    Window.add_window_rule(function(window)
        window:set_decoration_mode("server_side")
        my_border(window):decorate()
        window:set_maximized(false)
        window:set_fullscreen(false)
        if string.find(window:tags()[1]:name(), "%D") then
            window:set_floating(true)
            center(window, {width = 1000, height = 1000})
        end
    end)

Version info

pinnacle 0.2.3

Build Info:
Build profile: release
rustc version: 1.91.1
Branch: v0.2
Commit: b33d2fe (release: v0.2.3)

Distro

Arch

GPU

builtin intel

Config language

Lua

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions