diff --git a/contents/code/halflayout.js b/contents/code/halflayout.js index 0a906d2..25f62d9 100644 --- a/contents/code/halflayout.js +++ b/contents/code/halflayout.js @@ -30,7 +30,8 @@ function HalfLayout(screenRectangle) { } catch(err) { print(err, "in HalfLayout"); } - this.firstWidth = this.screenRectangle.width / 2; + this.masterRatio = 100 / KWin.readConfig("halfLayoutMasterRatio", 50); + this.firstWidth = this.screenRectangle.width / this.masterRatio; this.master = 0; this.masterCount = 1; }; @@ -57,7 +58,7 @@ HalfLayout.prototype.addTile = function() { var newWidth = this.screenRectangle.width / (this.tiles.length + 1); var newSWidth = newWidth; } else { - this.firstWidth = this.screenRectangle.width / 2; + this.firstWidth = this.screenRectangle.width / this.masterRatio; var newWidth = this.firstWidth / (this.tiles.length); var newSWidth = this.screenRectangle.width - this.firstWidth; } @@ -253,7 +254,7 @@ HalfLayout.prototype.decrementMaster = function() { var newSWidth = this.screenRectangle.width - (newMWidth * newC); var newSHeight = this.screenRectangle.height / (this.tiles.length - newC); } else if (this.tiles.length == oldC) { - var newMWidth = (this.screenRectangle.width / 2) / newC ; + var newMWidth = (this.screenRectangle.width / this.masterRatio) / newC ; var newSWidth = this.screenRectangle.width - (newMWidth * newC); var newSHeight = this.screenRectangle.height / (this.tiles.length - newC); } else { @@ -277,6 +278,6 @@ HalfLayout.prototype.decrementMaster = function() { if(newC != 0) { this.firstWidth = this.getMasterWidth(); } else { - this.firstWidth = this.screenRectangle.width / 2; + this.firstWidth = this.screenRectangle.width / this.masterRatio; } }; diff --git a/contents/config/main.xml b/contents/config/main.xml index 1cc3b5e..475fd21 100644 --- a/contents/config/main.xml +++ b/contents/config/main.xml @@ -69,5 +69,9 @@ false + + + 50 + diff --git a/contents/ui/config.ui b/contents/ui/config.ui index 5b551fe..d1ae84c 100644 --- a/contents/ui/config.ui +++ b/contents/ui/config.ui @@ -210,6 +210,62 @@ + + + Half Layout + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + % + + + 10 + + + 90 + + + 50 + + + + + + + Default master width + + + + +