From c8ae55b2865c8d0a05a4d45408c91951e41e273a Mon Sep 17 00:00:00 2001 From: Raven <152022920+Raven-002@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:01:01 +0300 Subject: [PATCH] Add rotate layout shortcut --- src/controller/actions/shortcuts.ts | 12 ++++++++++++ src/extern/qml.ts | 2 ++ src/qml/shortcuts.qml | 11 +++++++++++ 3 files changed, 25 insertions(+) diff --git a/src/controller/actions/shortcuts.ts b/src/controller/actions/shortcuts.ts index 390ae4a..6a8cde7 100644 --- a/src/controller/actions/shortcuts.ts +++ b/src/controller/actions/shortcuts.ts @@ -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)); @@ -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); + } } diff --git a/src/extern/qml.ts b/src/extern/qml.ts index 616eb57..51fe3f0 100644 --- a/src/extern/qml.ts +++ b/src/extern/qml.ts @@ -56,6 +56,8 @@ export interface Shortcuts { getResizeLeft(): ShortcutHandler; getResizeRight(): ShortcutHandler; + getRotateLayout(): ShortcutHandler; + getCycleEngine(): ShortcutHandler; getSwitchBTree(): ShortcutHandler; getSwitchHalf(): ShortcutHandler; diff --git a/src/qml/shortcuts.qml b/src/qml/shortcuts.qml index 85f97db..b45084f 100644 --- a/src/qml/shortcuts.qml +++ b/src/qml/shortcuts.qml @@ -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;