2023-03-06 06:38:43 +00:00
|
|
|
// SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2022-02-13 04:23:57 +00:00
|
|
|
|
2023-03-15 06:29:46 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Window
|
2022-02-13 04:23:57 +00:00
|
|
|
|
2023-03-15 06:29:46 +00:00
|
|
|
import org.kde.plasma.plasmoid
|
2023-07-25 02:24:10 +00:00
|
|
|
import org.kde.plasma.core as PlasmaCore
|
2023-03-15 06:29:46 +00:00
|
|
|
import org.kde.plasma.workspace.keyboardlayout as Keyboards
|
2022-02-13 04:23:57 +00:00
|
|
|
|
2023-03-15 06:29:46 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
|
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
|
|
|
|
import org.kde.taskmanager as TaskManager
|
|
|
|
|
import org.kde.plasma.private.mobileshell.windowplugin as WindowPlugin
|
2023-11-05 20:14:37 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
2022-02-13 04:23:57 +00:00
|
|
|
|
2023-07-25 02:24:10 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
MobileShell.NavigationPanel {
|
|
|
|
|
id: root
|
2022-06-27 18:52:16 +00:00
|
|
|
required property bool opaqueBar
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// background is:
|
2022-02-21 05:53:28 +00:00
|
|
|
// - opaque if an app is shown or vkbd is shown
|
2022-02-13 04:23:57 +00:00
|
|
|
// - translucent if the task switcher is open
|
|
|
|
|
// - transparent if on the homescreen
|
2024-03-13 04:08:42 +00:00
|
|
|
backgroundColor: (Keyboards.KWinVirtualKeyboard.active || opaqueBar) ? Kirigami.Theme.backgroundColor : "transparent";
|
2023-09-05 16:18:47 +00:00
|
|
|
foregroundColorGroup: opaqueBar ? Kirigami.Theme.Window : Kirigami.Theme.Complementary
|
2022-06-27 18:52:16 +00:00
|
|
|
shadow: !opaqueBar
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2023-03-06 06:38:43 +00:00
|
|
|
TaskManager.VirtualDesktopInfo {
|
|
|
|
|
id: virtualDesktopInfo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskManager.ActivityInfo {
|
|
|
|
|
id: activityInfo
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TaskManager.TasksModel {
|
|
|
|
|
id: tasksModel
|
|
|
|
|
filterByVirtualDesktop: true
|
|
|
|
|
filterByActivity: true
|
2023-11-05 20:19:24 +00:00
|
|
|
filterNotMaximized: false
|
2023-03-06 06:38:43 +00:00
|
|
|
filterByScreen: true
|
|
|
|
|
filterHidden: true
|
|
|
|
|
|
|
|
|
|
virtualDesktop: virtualDesktopInfo.currentDesktop
|
|
|
|
|
activity: activityInfo.currentActivity
|
|
|
|
|
|
|
|
|
|
groupMode: TaskManager.TasksModel.GroupDisabled
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// ~~~~
|
|
|
|
|
// navigation panel actions
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// toggle task switcher button
|
|
|
|
|
leftAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: taskSwitcherAction
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2023-03-06 06:38:43 +00:00
|
|
|
enabled: true
|
2022-02-13 04:23:57 +00:00
|
|
|
iconSource: "mobile-task-switcher"
|
|
|
|
|
iconSizeFactor: 0.75
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
onTriggered: {
|
2023-06-13 00:49:54 +00:00
|
|
|
Plasmoid.triggerTaskSwitcher();
|
2022-02-13 04:23:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// home button
|
|
|
|
|
middleAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: homeAction
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
enabled: true
|
|
|
|
|
iconSource: "start-here-kde"
|
|
|
|
|
iconSizeFactor: 1
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
onTriggered: {
|
2023-03-20 01:32:19 +00:00
|
|
|
MobileShellState.ShellDBusClient.openHomeScreen();
|
2022-02-13 04:23:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
// close app/keyboard button
|
|
|
|
|
rightAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: closeAppAction
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2024-03-13 04:08:42 +00:00
|
|
|
enabled: Keyboards.KWinVirtualKeyboard.active || WindowPlugin.WindowUtil.hasCloseableActiveWindow
|
|
|
|
|
iconSource: Keyboards.KWinVirtualKeyboard.active ? "go-down-symbolic" : "mobile-close-app"
|
2024-06-16 20:50:06 +00:00
|
|
|
// mobile-close-app (from plasma-frameworks) seems to have fewer margins than icons from breeze-icons
|
2024-03-13 04:08:42 +00:00
|
|
|
iconSizeFactor: Keyboards.KWinVirtualKeyboard.active ? 1 : 0.75
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
onTriggered: {
|
2022-03-19 02:58:19 +00:00
|
|
|
if (Keyboards.KWinVirtualKeyboard.active) {
|
2022-02-13 04:23:57 +00:00
|
|
|
// close keyboard if it is open
|
2022-03-19 02:58:19 +00:00
|
|
|
Keyboards.KWinVirtualKeyboard.active = false;
|
2023-03-15 06:29:46 +00:00
|
|
|
} else if (WindowPlugin.WindowUtil.hasCloseableActiveWindow) {
|
2022-02-13 04:23:57 +00:00
|
|
|
// if task switcher is closed, but there is an active window
|
2023-03-06 06:38:43 +00:00
|
|
|
if (tasksModel.activeTask !== 0) {
|
|
|
|
|
tasksModel.requestClose(tasksModel.activeTask);
|
2022-02-13 04:23:57 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2024-11-08 07:52:45 +00:00
|
|
|
leftCornerAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: rotationAction
|
|
|
|
|
visible: Plasmoid.showRotationButton
|
|
|
|
|
enabled: true
|
|
|
|
|
iconSource: "rotation-allowed-symbolic"
|
|
|
|
|
iconSizeFactor: 0.75
|
|
|
|
|
|
|
|
|
|
onTriggered: {
|
|
|
|
|
Plasmoid.rotateToSuggestedRotation();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-10 02:32:04 +00:00
|
|
|
rightCornerAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: keyboardToggleAction
|
2024-07-13 16:30:07 +00:00
|
|
|
visible: ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel ||
|
2023-11-05 20:14:37 +00:00
|
|
|
(Keyboards.KWinVirtualKeyboard.available && !Keyboards.KWinVirtualKeyboard.activeClientSupportsTextInput)
|
2022-09-12 12:12:24 +00:00
|
|
|
enabled: true
|
2022-09-10 02:32:04 +00:00
|
|
|
iconSource: "input-keyboard-virtual-symbolic"
|
|
|
|
|
iconSizeFactor: 0.75
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-09-10 02:32:04 +00:00
|
|
|
onTriggered: {
|
2024-03-13 04:08:42 +00:00
|
|
|
if (Keyboards.KWinVirtualKeyboard.active) {
|
2022-09-10 02:32:04 +00:00
|
|
|
Keyboards.KWinVirtualKeyboard.active = false;
|
|
|
|
|
} else {
|
|
|
|
|
Keyboards.KWinVirtualKeyboard.forceActivate();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-02-13 04:23:57 +00:00
|
|
|
}
|