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
|
2025-04-21 22:09:14 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.rotationplugin as RotationPlugin
|
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
|
2025-12-05 04:01:40 +00:00
|
|
|
|
2026-04-09 08:15:14 +00:00
|
|
|
visible: !ShellSettings.Settings.convergenceModeEnabled
|
|
|
|
|
|
2025-12-05 04:01:40 +00:00
|
|
|
// Whether the bar background should be opaque
|
2022-06-27 18:52:16 +00:00
|
|
|
required property bool opaqueBar
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2025-12-05 04:01:40 +00:00
|
|
|
// Whether the content should be forced to be white
|
|
|
|
|
required property bool forcedComplementary
|
|
|
|
|
|
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
|
2025-09-14 02:18:32 +00:00
|
|
|
backgroundColor: opaqueBar ? Kirigami.Theme.backgroundColor : "transparent"
|
2025-12-05 04:01:40 +00:00
|
|
|
foregroundColorGroup: forcedComplementary ? Kirigami.Theme.Complementary : Kirigami.Theme.Window
|
|
|
|
|
shadow: forcedComplementary
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2026-04-08 17:07:37 +00:00
|
|
|
// Convergence mode: expose running-app task strip
|
|
|
|
|
convergenceMode: ShellSettings.Settings.convergenceModeEnabled
|
|
|
|
|
taskModel: tasksModel
|
2026-04-08 18:12:38 +00:00
|
|
|
virtualDesktopInfo: virtualDesktopInfo
|
2026-04-08 17:07:37 +00:00
|
|
|
|
panels: Add support for defining device specific panel tweaks
This adds support for specifying options needed to deal with phone
display panel pecularities (ex. screen curves, notches, punch holes)
This is implemented as settings in ~/.config/plasmamobilerc, which can
set panel heights, paddings, and center spacings to duck display
cutouts. The pixel values are scaling independent, and so are not
affected when the display scaling is changed.
This is then exposed over DBus, so that components from outside of
plasmashell (ex. KWin) can access it easily without needing to connect to
kscreen themselves. Each screen is exposed as a single object.
Currently support is only added in the status bar and the navigation
panel.
Currently all screens have the settings applied. In the future, we may
want to limit this just to the internal screen (?)
---
This also adds a "devices" folder (in `devices/configs`) where per-device configs can be set.
This is installed to `/usr/share/plasma-mobile-device-configs`.
In `plasmamobilerc` (installed to `/etc/xdg/plasmamobilerc`, or
`~/.config/plasmamobilerc`), envmanager will read:
```toml
[Device]
device=oneplus-enchilada
```
for the device config to use and write its settings to
`~/.config/plasma-mobile/plasmamobilerc`.
2025-10-05 23:06:52 +00:00
|
|
|
MobileShellState.PanelSettingsDBusClient {
|
|
|
|
|
id: panelSettings
|
|
|
|
|
screenName: Screen.name
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
leftPadding: panelSettings.navigationPanelLeftPadding
|
|
|
|
|
rightPadding: panelSettings.navigationPanelRightPadding
|
|
|
|
|
|
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
|
|
|
|
2026-04-08 17:07:37 +00:00
|
|
|
// toggle task switcher button (KWin Overview in convergence mode, mobile task switcher otherwise)
|
2022-02-13 04:23:57 +00:00
|
|
|
leftAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: taskSwitcherAction
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2023-03-06 06:38:43 +00:00
|
|
|
enabled: true
|
2026-04-08 17:07:37 +00:00
|
|
|
iconSource: ShellSettings.Settings.convergenceModeEnabled ? "view-grid-symbolic" : "mobile-task-switcher"
|
|
|
|
|
shrinkSize: ShellSettings.Settings.convergenceModeEnabled ? 0 : 4
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
onTriggered: {
|
2026-04-08 17:07:37 +00:00
|
|
|
if (ShellSettings.Settings.convergenceModeEnabled) {
|
|
|
|
|
Plasmoid.triggerOverview();
|
|
|
|
|
} else {
|
|
|
|
|
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"
|
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
|
|
|
|
2026-04-09 08:15:14 +00:00
|
|
|
// close app/keyboard button (hidden in convergence mode — windows have title bar close buttons)
|
2022-02-13 04:23:57 +00:00
|
|
|
rightAction: MobileShell.NavigationPanelAction {
|
|
|
|
|
id: closeAppAction
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2026-04-09 08:15:14 +00:00
|
|
|
visible: !ShellSettings.Settings.convergenceModeEnabled
|
2025-07-11 04:17:57 +00:00
|
|
|
enabled: Keyboards.KWinVirtualKeyboard.visible || WindowPlugin.WindowUtil.hasCloseableActiveWindow
|
|
|
|
|
iconSource: Keyboards.KWinVirtualKeyboard.visible ? "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
|
panels: Add support for defining device specific panel tweaks
This adds support for specifying options needed to deal with phone
display panel pecularities (ex. screen curves, notches, punch holes)
This is implemented as settings in ~/.config/plasmamobilerc, which can
set panel heights, paddings, and center spacings to duck display
cutouts. The pixel values are scaling independent, and so are not
affected when the display scaling is changed.
This is then exposed over DBus, so that components from outside of
plasmashell (ex. KWin) can access it easily without needing to connect to
kscreen themselves. Each screen is exposed as a single object.
Currently support is only added in the status bar and the navigation
panel.
Currently all screens have the settings applied. In the future, we may
want to limit this just to the internal screen (?)
---
This also adds a "devices" folder (in `devices/configs`) where per-device configs can be set.
This is installed to `/usr/share/plasma-mobile-device-configs`.
In `plasmamobilerc` (installed to `/etc/xdg/plasmamobilerc`, or
`~/.config/plasmamobilerc`), envmanager will read:
```toml
[Device]
device=oneplus-enchilada
```
for the device config to use and write its settings to
`~/.config/plasma-mobile/plasmamobilerc`.
2025-10-05 23:06:52 +00:00
|
|
|
shrinkSize: Keyboards.KWinVirtualKeyboard.visible ? 0 : 4
|
2024-07-13 16:30:07 +00:00
|
|
|
|
2022-02-13 04:23:57 +00:00
|
|
|
onTriggered: {
|
2025-07-11 04:17:57 +00:00
|
|
|
if (Keyboards.KWinVirtualKeyboard.visible) {
|
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
|
2025-04-21 22:09:14 +00:00
|
|
|
visible: RotationPlugin.RotationUtil.showRotationButton
|
2024-11-08 07:52:45 +00:00
|
|
|
enabled: true
|
|
|
|
|
iconSource: "rotation-allowed-symbolic"
|
panels: Add support for defining device specific panel tweaks
This adds support for specifying options needed to deal with phone
display panel pecularities (ex. screen curves, notches, punch holes)
This is implemented as settings in ~/.config/plasmamobilerc, which can
set panel heights, paddings, and center spacings to duck display
cutouts. The pixel values are scaling independent, and so are not
affected when the display scaling is changed.
This is then exposed over DBus, so that components from outside of
plasmashell (ex. KWin) can access it easily without needing to connect to
kscreen themselves. Each screen is exposed as a single object.
Currently support is only added in the status bar and the navigation
panel.
Currently all screens have the settings applied. In the future, we may
want to limit this just to the internal screen (?)
---
This also adds a "devices" folder (in `devices/configs`) where per-device configs can be set.
This is installed to `/usr/share/plasma-mobile-device-configs`.
In `plasmamobilerc` (installed to `/etc/xdg/plasmamobilerc`, or
`~/.config/plasmamobilerc`), envmanager will read:
```toml
[Device]
device=oneplus-enchilada
```
for the device config to use and write its settings to
`~/.config/plasma-mobile/plasmamobilerc`.
2025-10-05 23:06:52 +00:00
|
|
|
shrinkSize: 4
|
2024-11-08 07:52:45 +00:00
|
|
|
|
|
|
|
|
onTriggered: {
|
2025-04-21 22:09:14 +00:00
|
|
|
RotationPlugin.RotationUtil.rotateToSuggestedRotation();
|
2024-11-08 07:52:45 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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"
|
panels: Add support for defining device specific panel tweaks
This adds support for specifying options needed to deal with phone
display panel pecularities (ex. screen curves, notches, punch holes)
This is implemented as settings in ~/.config/plasmamobilerc, which can
set panel heights, paddings, and center spacings to duck display
cutouts. The pixel values are scaling independent, and so are not
affected when the display scaling is changed.
This is then exposed over DBus, so that components from outside of
plasmashell (ex. KWin) can access it easily without needing to connect to
kscreen themselves. Each screen is exposed as a single object.
Currently support is only added in the status bar and the navigation
panel.
Currently all screens have the settings applied. In the future, we may
want to limit this just to the internal screen (?)
---
This also adds a "devices" folder (in `devices/configs`) where per-device configs can be set.
This is installed to `/usr/share/plasma-mobile-device-configs`.
In `plasmamobilerc` (installed to `/etc/xdg/plasmamobilerc`, or
`~/.config/plasmamobilerc`), envmanager will read:
```toml
[Device]
device=oneplus-enchilada
```
for the device config to use and write its settings to
`~/.config/plasma-mobile/plasmamobilerc`.
2025-10-05 23:06:52 +00:00
|
|
|
shrinkSize: 4
|
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
|
|
|
}
|