Skip to content

Introduce gaps between windows. #36

Open
@lukaszkieronski

Description

@lukaszkieronski

I really love your script, but in my case I had to introduce small gaps between windows. Here is a patched function. It would be nice if this feature is configurable.

function newSlotPosition(workspace, client, numberXslots, numberYslots, x, y, xSlotToFill, ySlotToFill) {
    var maxArea = workspace.clientArea(KWin.MaximizeArea, client);

    var newX = maxArea.x + Math.round(maxArea.width / numberXslots * x) + 8;
    var newY = maxArea.y + Math.round(maxArea.height / numberYslots * y) + 8;

    var gapX = x + xSlotToFill < numberXslots ? 8 : 0;
    var gapY = y + ySlotToFill < numberYslots ? 8 : 0;

    // Width and height is calculated by finding where the window should end and subtracting where it should start
    var clientWidth = Math.round(maxArea.width / numberXslots * (x + xSlotToFill)) - (newX - maxArea.x) - 8 + gapX;
    var clientHeight = Math.round(maxArea.height / numberYslots * (y + ySlotToFill)) - (newY - maxArea.y) - 8 + gapY;

    return [newX, newY, clientWidth, clientHeight]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions