devilspie2 icon indicating copy to clipboard operation
devilspie2 copied to clipboard

[Question] geometry and maximization

Open xenogenesi opened this issue 2 years ago • 0 comments

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

xenogenesi avatar Dec 02 '22 13:12 xenogenesi