mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
In convergence mode the separate navigation panel is redundant with window title-bar controls. Remove it by setting its thickness to zero and visibility to false, then embed Home and Overview buttons at the left and right ends of the favourites bar. Running application icons with context menus are shown between the favourites and the Overview button. Add HomeScreen::triggerOverview() to invoke the KWin Overview shortcut over D-Bus so the homescreen containment can open it without access to the task-panel Plasmoid.
158 lines
5.3 KiB
QML
158 lines
5.3 KiB
QML
// SPDX-FileCopyrightText: 2021-2023 Devin Lin <devin@kde.org>
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Window
|
|
|
|
import org.kde.plasma.plasmoid
|
|
import org.kde.plasma.core as PlasmaCore
|
|
import org.kde.plasma.workspace.keyboardlayout as Keyboards
|
|
|
|
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
|
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
|
import org.kde.plasma.private.mobileshell.rotationplugin as RotationPlugin
|
|
|
|
import org.kde.kirigami as Kirigami
|
|
|
|
MobileShell.NavigationPanel {
|
|
id: root
|
|
|
|
visible: !ShellSettings.Settings.convergenceModeEnabled
|
|
|
|
// Whether the bar background should be opaque
|
|
required property bool opaqueBar
|
|
|
|
// Whether the content should be forced to be white
|
|
required property bool forcedComplementary
|
|
|
|
// background is:
|
|
// - opaque if an app is shown or vkbd is shown
|
|
// - translucent if the task switcher is open
|
|
// - transparent if on the homescreen
|
|
backgroundColor: opaqueBar ? Kirigami.Theme.backgroundColor : "transparent"
|
|
foregroundColorGroup: forcedComplementary ? Kirigami.Theme.Complementary : Kirigami.Theme.Window
|
|
shadow: forcedComplementary
|
|
|
|
// Convergence mode: expose running-app task strip
|
|
convergenceMode: ShellSettings.Settings.convergenceModeEnabled
|
|
taskModel: tasksModel
|
|
virtualDesktopInfo: virtualDesktopInfo
|
|
|
|
MobileShellState.PanelSettingsDBusClient {
|
|
id: panelSettings
|
|
screenName: Screen.name
|
|
}
|
|
|
|
leftPadding: panelSettings.navigationPanelLeftPadding
|
|
rightPadding: panelSettings.navigationPanelRightPadding
|
|
|
|
TaskManager.VirtualDesktopInfo {
|
|
id: virtualDesktopInfo
|
|
}
|
|
|
|
TaskManager.ActivityInfo {
|
|
id: activityInfo
|
|
}
|
|
|
|
TaskManager.TasksModel {
|
|
id: tasksModel
|
|
filterByVirtualDesktop: true
|
|
filterByActivity: true
|
|
filterNotMaximized: false
|
|
filterByScreen: true
|
|
filterHidden: true
|
|
|
|
virtualDesktop: virtualDesktopInfo.currentDesktop
|
|
activity: activityInfo.currentActivity
|
|
|
|
groupMode: TaskManager.TasksModel.GroupDisabled
|
|
}
|
|
|
|
// ~~~~
|
|
// navigation panel actions
|
|
|
|
// toggle task switcher button (KWin Overview in convergence mode, mobile task switcher otherwise)
|
|
leftAction: MobileShell.NavigationPanelAction {
|
|
id: taskSwitcherAction
|
|
|
|
enabled: true
|
|
iconSource: ShellSettings.Settings.convergenceModeEnabled ? "view-grid-symbolic" : "mobile-task-switcher"
|
|
shrinkSize: ShellSettings.Settings.convergenceModeEnabled ? 0 : 4
|
|
|
|
onTriggered: {
|
|
if (ShellSettings.Settings.convergenceModeEnabled) {
|
|
Plasmoid.triggerOverview();
|
|
} else {
|
|
Plasmoid.triggerTaskSwitcher();
|
|
}
|
|
}
|
|
}
|
|
|
|
// home button
|
|
middleAction: MobileShell.NavigationPanelAction {
|
|
id: homeAction
|
|
|
|
enabled: true
|
|
iconSource: "start-here-kde"
|
|
|
|
onTriggered: {
|
|
MobileShellState.ShellDBusClient.openHomeScreen();
|
|
}
|
|
}
|
|
|
|
// close app/keyboard button (hidden in convergence mode — windows have title bar close buttons)
|
|
rightAction: MobileShell.NavigationPanelAction {
|
|
id: closeAppAction
|
|
|
|
visible: !ShellSettings.Settings.convergenceModeEnabled
|
|
enabled: Keyboards.KWinVirtualKeyboard.visible || WindowPlugin.WindowUtil.hasCloseableActiveWindow
|
|
iconSource: Keyboards.KWinVirtualKeyboard.visible ? "go-down-symbolic" : "mobile-close-app"
|
|
// mobile-close-app (from plasma-frameworks) seems to have fewer margins than icons from breeze-icons
|
|
shrinkSize: Keyboards.KWinVirtualKeyboard.visible ? 0 : 4
|
|
|
|
onTriggered: {
|
|
if (Keyboards.KWinVirtualKeyboard.visible) {
|
|
// close keyboard if it is open
|
|
Keyboards.KWinVirtualKeyboard.active = false;
|
|
} else if (WindowPlugin.WindowUtil.hasCloseableActiveWindow) {
|
|
// if task switcher is closed, but there is an active window
|
|
if (tasksModel.activeTask !== 0) {
|
|
tasksModel.requestClose(tasksModel.activeTask);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
leftCornerAction: MobileShell.NavigationPanelAction {
|
|
id: rotationAction
|
|
visible: RotationPlugin.RotationUtil.showRotationButton
|
|
enabled: true
|
|
iconSource: "rotation-allowed-symbolic"
|
|
shrinkSize: 4
|
|
|
|
onTriggered: {
|
|
RotationPlugin.RotationUtil.rotateToSuggestedRotation();
|
|
}
|
|
}
|
|
|
|
rightCornerAction: MobileShell.NavigationPanelAction {
|
|
id: keyboardToggleAction
|
|
visible: ShellSettings.Settings.alwaysShowKeyboardToggleOnNavigationPanel ||
|
|
(Keyboards.KWinVirtualKeyboard.available && !Keyboards.KWinVirtualKeyboard.activeClientSupportsTextInput)
|
|
enabled: true
|
|
iconSource: "input-keyboard-virtual-symbolic"
|
|
shrinkSize: 4
|
|
|
|
onTriggered: {
|
|
if (Keyboards.KWinVirtualKeyboard.active) {
|
|
Keyboards.KWinVirtualKeyboard.active = false;
|
|
} else {
|
|
Keyboards.KWinVirtualKeyboard.forceActivate();
|
|
}
|
|
}
|
|
}
|
|
}
|