Skip to content

Commit

Permalink
Add rotate layout shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
Raven-002 committed Jun 18, 2024
1 parent 515f699 commit c8ae55b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/controller/actions/shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export class ShortcutManager {
.getResizeRight()
.activated.connect(this.resize.bind(this, Direction.Right));

shortcuts
.getRotateLayout()
.activated.connect(this.rotateLayout.bind(this));

shortcuts
.getCycleEngine()
.activated.connect(this.cycleEngine.bind(this));
Expand Down Expand Up @@ -337,4 +341,12 @@ export class ShortcutManager {
this.ctrl.qmlObjects.osd.show(engineName(engineType));
this.ctrl.driverManager.setEngineConfig(desktop, engineConfig);
}

rotateLayout(): void {
const desktop = this.ctrl.desktopFactory.createDefaultDesktop();
const engineConfig = this.ctrl.driverManager.getEngineConfig(desktop);
engineConfig.rotateLayout = !engineConfig.rotateLayout;
this.ctrl.qmlObjects.osd.show("Rotate Layout: " + engineConfig.rotateLayout);
this.ctrl.driverManager.setEngineConfig(desktop, engineConfig);
}
}
2 changes: 2 additions & 0 deletions src/extern/qml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ export interface Shortcuts {
getResizeLeft(): ShortcutHandler;
getResizeRight(): ShortcutHandler;

getRotateLayout(): ShortcutHandler;

getCycleEngine(): ShortcutHandler;
getSwitchBTree(): ShortcutHandler;
getSwitchHalf(): ShortcutHandler;
Expand Down
11 changes: 11 additions & 0 deletions src/qml/shortcuts.qml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,17 @@ Item {
text: "Polonium: Resize Right";
sequence: "Meta+Ctrl+L";
}

function getRotateLayout() {
return rotateLayout;
}
ShortcutHandler {
id: rotateLayout;

name: "PoloniumRotateLayout";
text: "Polonium: Rotate Layout";
sequence: "";
}

function getCycleEngine() {
return cycleEngine;
Expand Down

0 comments on commit c8ae55b

Please sign in to comment.