Skip to content

Commit

Permalink
remove gaps from between tiles
Browse files Browse the repository at this point in the history
fixes #42
  • Loading branch information
GrylledCheez committed May 26, 2023
1 parent 5a1d88a commit e62faa9
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ function moveApp(app, loc) {
var colWidth = Math.floor(space.width / colCount);
var rowHeight = Math.floor(space.height / 2);

let x = loc.col * colWidth + space.x;
let x = space.parts[loc.col].partialOffset + space.x;
let y = loc.row * rowHeight + space.y;
let w = loc.width * colWidth;
let w = colWidth;
let h = loc.height * rowHeight;

if (!config.useMaximize) {
Expand Down Expand Up @@ -1115,6 +1115,23 @@ function getCurrentMonitor() {
return monitorProvider.get_current_monitor();
}

/**
* @param {number} screenWidth - screen width
* @param {number} colCount - number of cols to split into
*/
function splitScreenWidth(screenWidth, colCount) {
var partSize = Math.floor(screenWidth / colCount);
var leftover = screenWidth % colCount;

var parts = new Array(colCount).fill(partSize).map(function (size, index) {
return {
partialWidth: size + (index < leftover ? 1 : 0),
partialOffset: index * partSize + Math.min(index, leftover)
};
});
return parts;
}

/**
*
*/
Expand Down

0 comments on commit e62faa9

Please sign in to comment.