Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Option to maximize when there is only one window #235

@deleterium

Description

@deleterium

Hi! I know there is no big difference when the window is maximized or just resized to entire screen. But of course there is a difference in some applications. Some users may prefer to use the window maximized when there is only one!

My case is that I use another script for kwin named hide-titles ( https://github.com/bahamondev/hide-titles ). That script hides the title bar only when the window is maximized, but that script didn't work with this project...

I'm not pro in programming, but I solved this issue creating couple of lines, that add new config. I set it manually in kwinrc (I don't have knowledge to edit the .ui files and their control logic). So I just let the code here to make easier to implement this enhancement!

diff --git a/contents/code/tiling.js b/contents/code/tiling.js
index de5c117..36f66fc 100644
--- a/contents/code/tiling.js
+++ b/contents/code/tiling.js
@@ -50,6 +50,7 @@ function Tiling(layoutType, desktop, screen) {
         this.userActive = true;
 
         var gapSize = KWin.readConfig("gapSize", 0);  /* stick to old gaps config by default */
+        this.maximizeWhenOnlyOne = KWin.readConfig("maximizeWhenOnlyOne", false);
         this.windowsGapSizeHeight = KWin.readConfig("windowsGapSizeHeight", gapSize);
         this.windowsGapSizeWidth = KWin.readConfig("windowsGapSizeWidth", gapSize);
         this.screenGapSizeLeft = KWin.readConfig("screenGapSizeLeft", 0);
@@ -344,6 +345,10 @@ Tiling.prototype._updateAllTiles = function() {
         // Set the position/size of all tiles
         if (this.active == true && this.userActive == true) {
             this.resizeScreen();
+            if (this.layout.tiles.length == 1 && this.maximizeWhenOnlyOne == true) {
+                this.tiles[0].clients[0].setMaximize(true, true);
+                    return;
+            }
             for (var i = 0; i < this.layout.tiles.length; i++) {
                 var newRect = this.layout.tiles[i].rectangle;
                 if (! newRect) {
´´´

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions