Skip to content

[Question] geometry and maximization #9

@xenogenesi

Description

@xenogenesi

Hello, thanks for this project!

I'm using it to position and create all the windows in the second screen, which in my case means: if x < 1920 then add 1920

The problem I'm having is that: if I unmaximize a window it goes back to the first screen, is there any property to change also the x of the "normal" geometry of maximized windows? Or some other way?

Thanks in advance

name = get_window_name()
type = get_window_type()
if (type ~= "WINDOW_TYPE_DESKTOP") then
    print("Name: "..name)
    print("Type: "..type)
    x, y, width, height = get_window_geometry()
    print("X: "..x..", Y: "..y..", width: "..width..", height: "..height)
    if (x < 1920) then
        -- set_window_position(x + 1920, y)
        -- set_window_geometry(x + 1920, y, width, height)
        set_window_geometry2(x + 1920, y, width, height)
    end
end

*edit:

As a workaround for the moment I take off the maximization, change x and then restore it, it seems to work, I'd still be interested if there are cleaner/easier solutions

    max = get_window_is_maximized()
    maxw = get_window_is_maximized_horizontally()
    maxh = get_window_is_maximized_vertically()
    if max or maxw or maxh then
        unmaximize()
    end
    if max then
        maximize()
    else
        if maxw then
            maximize_horizontally()
        end
        if maxh then
            maximize_vertically()
        end
    end

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions