diff --git a/docs/usage.md b/docs/usage.md
index 5ad73bf..306df6b 100644
--- a/docs/usage.md
+++ b/docs/usage.md
@@ -82,6 +82,7 @@ Polonium requires that KWin be restarted every time the configuration is changed
- Layout engine (dropdown) - The default tiling engine you want to use on new desktops
- Insertion point (dropdown) - Select where new windows should be inserted into the layout
- Rotate layout (check box) - Whether to rotate the layout 90 degrees (split horizontally instead of vertically)
+- Auto rotate layout (check box) - Automatically rotate layout if desktop/output width is less than its height (for example in case of vertical display)
### Debug options
diff --git a/res/config.ui b/res/config.ui
index d59e8ba..1bc231f 100644
--- a/res/config.ui
+++ b/res/config.ui
@@ -120,6 +120,16 @@
+ -
+
+
+ Auto rotate layout
+
+
+ true
+
+
+
-
diff --git a/res/main.xml b/res/main.xml
index 15b5078..3e6199b 100644
--- a/res/main.xml
+++ b/res/main.xml
@@ -15,5 +15,6 @@
0
0
false
+ true
diff --git a/src/driver/index.ts b/src/driver/index.ts
index 9fb7fd3..6e92824 100644
--- a/src/driver/index.ts
+++ b/src/driver/index.ts
@@ -54,10 +54,16 @@ export class DriverManager {
desktopString,
);
let engineType = this.config.engineType;
+ let rotateLayout = this.config.rotateLayout;
+ if (this.config.autoRotateLayout &&
+ desktop.output.geometry.width < desktop.output.geometry.height) {
+ this.logger.debug("Auto rotate layout for desktop", desktopString);
+ rotateLayout = !rotateLayout;
+ }
const config: EngineConfig = {
engineType: engineType,
insertionPoint: this.config.insertionPoint,
- rotateLayout: this.config.rotateLayout,
+ rotateLayout: rotateLayout,
engineSettings: {},
};
const engine = this.engineFactory.newEngine(config);
diff --git a/src/util/config.ts b/src/util/config.ts
index 4ee0756..d9122b4 100644
--- a/src/util/config.ts
+++ b/src/util/config.ts
@@ -51,6 +51,7 @@ export class Config {
this.engineType = rc("EngineType", EngineType.BTree);
this.insertionPoint = rc("InsertionPoint", InsertionPoint.Left);
this.rotateLayout = rc("RotateLayout", false);
+ this.autoRotateLayout = rc("AutoRotateLayout", true);
}
debug: boolean = false;
@@ -75,4 +76,5 @@ export class Config {
engineType: EngineType = EngineType.BTree;
insertionPoint: InsertionPoint = InsertionPoint.Left;
rotateLayout: boolean = true;
+ autoRotateLayout: boolean = true;
}