Skip to content

Commit

Permalink
Merge pull request #169 from feryllt/master
Browse files Browse the repository at this point in the history
Toggle rotateLayout automatically to support vertical outputs
  • Loading branch information
zeroxoneafour committed Jun 1, 2024
2 parents 59f2324 + 35f14de commit 515f699
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 10 additions & 0 deletions res/config.ui
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@
</property>
</widget>
</item>
<item row="39" column="1">
<widget class="QCheckBox" name="kcfg_AutoRotateLayout">
<property name="text">
<string>Auto rotate layout</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QCheckBox" name="kcfg_KeepTiledBelow">
<property name="text">
Expand Down
1 change: 1 addition & 0 deletions res/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
<entry name="EngineType" type="int"><default>0</default></entry>
<entry name="InsertionPoint" type="int"><default>0</default></entry>
<entry name="RotateLayout" type="bool"><default>false</default></entry>
<entry name="AutoRotateLayout" type="bool"><default>true</default></entry>
</group>
</kcfg>
8 changes: 7 additions & 1 deletion src/driver/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/util/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -75,4 +76,5 @@ export class Config {
engineType: EngineType = EngineType.BTree;
insertionPoint: InsertionPoint = InsertionPoint.Left;
rotateLayout: boolean = true;
autoRotateLayout: boolean = true;
}

0 comments on commit 515f699

Please sign in to comment.