Skip to content

Commit

Permalink
implement monocle maximization option
Browse files Browse the repository at this point in the history
 * When enabled, always maximizes tiles in monocle layout
 * implements user suggestion (#28)
  • Loading branch information
esjeon committed Feb 10, 2019
1 parent 241a944 commit 4673135
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 4 deletions.
19 changes: 18 additions & 1 deletion res/config.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>580</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -164,6 +164,23 @@
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="monocleLayoutConfigLayout">
<property name="leftMargin">
<number>40</number>
</property>
<item>
<widget class="QCheckBox" name="kcfg_monocleMaximize">
<property name="text">
<string>Maximize window</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_enableSpreadLayout">
<property name="text">
Expand Down
5 changes: 5 additions & 0 deletions res/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
<default>false</default>
</entry>

<entry name="monocleMaximize" type="Bool">
<label>Always maximize windows in Monocle layout</label>
<default>true</default>
</entry>

<entry name="mouseAdjustLayout" type="Bool">
<label>Adjust layout with mouse</label>
<default>true</default>
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Config {
public static layoutPerActivity: boolean;
public static layoutPerDesktop: boolean;
public static maximizeSoleTile: boolean;
public static monocleMaximize: boolean;
public static mouseAdjustLayout: boolean;
public static noTileBorder: boolean;
public static screenGapBottom: number;
Expand Down Expand Up @@ -62,6 +63,7 @@ class Config {
load("layoutPerActivity", false);
load("layoutPerDesktop", false);
load("maximizeSoleTile", false);
load("monocleMaximize", true);
load("mouseAdjustLayout", true);
load("noTileBorder", false);
load("screenGapBottom", 0);
Expand Down
2 changes: 1 addition & 1 deletion src/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class TilingEngine {
tile.hideBorder = (Config.noTileBorder) ? tile.tileable : false;
});

layout.apply(tileables, area);
layout.apply(tileables, area, workingArea);
}

visibles.forEach((tile) => tile.commit(true));
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/ilayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
interface ILayout {
adjust?(area: Rect, tiles: Tile[], basis: Tile): void;

apply(tiles: Tile[], area: Rect): void;
apply(tiles: Tile[], area: Rect, workingArea?: Rect): void;

handleUserInput?(input: UserInput, data?: any): boolean;
/* if true, layout completely overrides the default behavior */
Expand Down
6 changes: 5 additions & 1 deletion src/layouts/monoclelayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
// DEALINGS IN THE SOFTWARE.

class MonocleLayout implements ILayout {
public apply = (tiles: Tile[], area: Rect): void => {
public apply = (tiles: Tile[], area: Rect, workingArea?: Rect): void => {
if (Config.monocleMaximize) {
area = workingArea || area;
tiles.forEach((tile) => tile.hideBorder = true);
}
tiles.forEach((tile) => (tile.geometry = area));
}

Expand Down

0 comments on commit 4673135

Please sign in to comment.