Commit d40aec08 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

effects/desktopgrid: Allow switching between desktops using digit and function keys

C++ version allowed switching between virtual desktops by pressing
function keys (Fn) or digit keys.

BUG: 455292
parent 48f69146
Pipeline #193611 passed with stage
in 13 minutes and 52 seconds
......@@ -33,6 +33,11 @@ Rectangle {
container.organized = false;
}
function switchTo(desktopId) {
KWinComponents.Workspace.currentDesktop = desktopId;
container.effect.deactivate(container.effect.animationDuration);
}
Keys.onPressed: {
if (event.key == Qt.Key_Escape) {
effect.deactivate(effect.animationDuration);
......@@ -40,6 +45,12 @@ Rectangle {
addButton.clicked();
} else if (event.key == Qt.Key_Minus) {
removeButton.clicked();
} else if (event.key >= Qt.Key_F1 && event.key <= Qt.Key_F12) {
const desktopId = (event.key - Qt.Key_F1) + 1;
switchTo(desktopId);
} else if (event.key >= Qt.Key_0 && event.key <= Qt.Key_9) {
const desktopId = event.key == Qt.Key_0 ? 10 : (event.key - Qt.Key_0);
switchTo(desktopId);
}
}
Keys.priority: Keys.AfterItem
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment