Skip to content

Commit 515f699

Browse files
Merge pull request #169 from feryllt/master
Toggle rotateLayout automatically to support vertical outputs
2 parents 59f2324 + 35f14de commit 515f699

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

docs/usage.md

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Polonium requires that KWin be restarted every time the configuration is changed
8282
- Layout engine (dropdown) - The default tiling engine you want to use on new desktops
8383
- Insertion point (dropdown) - Select where new windows should be inserted into the layout
8484
- Rotate layout (check box) - Whether to rotate the layout 90 degrees (split horizontally instead of vertically)
85+
- Auto rotate layout (check box) - Automatically rotate layout if desktop/output width is less than its height (for example in case of vertical display)
8586

8687
### Debug options
8788

res/config.ui

+10
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@
120120
</property>
121121
</widget>
122122
</item>
123+
<item row="39" column="1">
124+
<widget class="QCheckBox" name="kcfg_AutoRotateLayout">
125+
<property name="text">
126+
<string>Auto rotate layout</string>
127+
</property>
128+
<property name="checked">
129+
<bool>true</bool>
130+
</property>
131+
</widget>
132+
</item>
123133
<item row="13" column="1">
124134
<widget class="QCheckBox" name="kcfg_KeepTiledBelow">
125135
<property name="text">

res/main.xml

+1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@
1515
<entry name="EngineType" type="int"><default>0</default></entry>
1616
<entry name="InsertionPoint" type="int"><default>0</default></entry>
1717
<entry name="RotateLayout" type="bool"><default>false</default></entry>
18+
<entry name="AutoRotateLayout" type="bool"><default>true</default></entry>
1819
</group>
1920
</kcfg>

src/driver/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ export class DriverManager {
5454
desktopString,
5555
);
5656
let engineType = this.config.engineType;
57+
let rotateLayout = this.config.rotateLayout;
58+
if (this.config.autoRotateLayout &&
59+
desktop.output.geometry.width < desktop.output.geometry.height) {
60+
this.logger.debug("Auto rotate layout for desktop", desktopString);
61+
rotateLayout = !rotateLayout;
62+
}
5763
const config: EngineConfig = {
5864
engineType: engineType,
5965
insertionPoint: this.config.insertionPoint,
60-
rotateLayout: this.config.rotateLayout,
66+
rotateLayout: rotateLayout,
6167
engineSettings: {},
6268
};
6369
const engine = this.engineFactory.newEngine(config);

src/util/config.ts

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class Config {
5151
this.engineType = rc("EngineType", EngineType.BTree);
5252
this.insertionPoint = rc("InsertionPoint", InsertionPoint.Left);
5353
this.rotateLayout = rc("RotateLayout", false);
54+
this.autoRotateLayout = rc("AutoRotateLayout", true);
5455
}
5556

5657
debug: boolean = false;
@@ -75,4 +76,5 @@ export class Config {
7576
engineType: EngineType = EngineType.BTree;
7677
insertionPoint: InsertionPoint = InsertionPoint.Left;
7778
rotateLayout: boolean = true;
79+
autoRotateLayout: boolean = true;
7880
}

0 commit comments

Comments
 (0)