2021-04-09 20:59:05 +00:00
|
|
|
/*
|
|
|
|
|
* SPDX-FileCopyrightText: 2015 Marco Martin <mart@kde.org>
|
|
|
|
|
* SPDX-FileCopyrightText: 2021 Devin Lin <espidev@gmail.com>
|
|
|
|
|
*
|
2021-12-22 23:29:00 +00:00
|
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
2021-04-09 20:59:05 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
2023-05-13 02:07:48 +00:00
|
|
|
import QtQuick
|
|
|
|
|
import QtQuick.Layouts
|
|
|
|
|
import QtQuick.Effects
|
|
|
|
|
import QtQuick.Controls as Controls
|
|
|
|
|
import QtQml.Models
|
2021-04-09 20:59:05 +00:00
|
|
|
|
2023-07-25 02:24:10 +00:00
|
|
|
import org.kde.kirigami as Kirigami
|
2023-07-25 01:13:52 +00:00
|
|
|
|
2023-09-05 15:34:49 +00:00
|
|
|
import org.kde.plasma.core as PlasmaCore
|
2025-11-12 21:20:11 +00:00
|
|
|
import org.kde.plasma.clock
|
2024-01-20 04:44:57 +00:00
|
|
|
import org.kde.plasma.private.systemtray as SystemTray
|
2021-04-09 20:59:05 +00:00
|
|
|
import org.kde.plasma.components 3.0 as PlasmaComponents
|
2023-08-29 14:30:12 +00:00
|
|
|
import org.kde.kitemmodels as KItemModels
|
2023-11-02 11:08:17 +00:00
|
|
|
import org.kde.plasma.private.mobileshell as MobileShell
|
2024-10-17 17:20:14 +00:00
|
|
|
import org.kde.plasma.private.mobileshell.shellsettingsplugin as ShellSettings
|
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
|
|
|
import org.kde.plasma.private.mobileshell.state as MobileShellState
|
2021-04-09 20:59:05 +00:00
|
|
|
|
|
|
|
|
Item {
|
2021-12-22 23:29:00 +00:00
|
|
|
id: root
|
2024-01-21 07:23:17 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* Whether to show a drop shadow under the status bar.
|
|
|
|
|
*/
|
|
|
|
|
property bool showDropShadow: false
|
2024-01-21 07:23:17 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* The background color of the status bar.
|
|
|
|
|
*/
|
|
|
|
|
property color backgroundColor: "transparent"
|
2024-01-21 07:23:17 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* Whether to show a second row of the status bar, with more information.
|
|
|
|
|
*/
|
2021-10-12 13:50:36 +00:00
|
|
|
property bool showSecondRow: false // show extra row with date and mobile provider
|
2024-01-21 07:23:17 +00:00
|
|
|
|
2021-12-22 23:29:00 +00:00
|
|
|
/**
|
|
|
|
|
* Whether to show time. If set to false, the signal strength indicator is moved in its place.
|
|
|
|
|
*/
|
|
|
|
|
property bool showTime: true
|
2024-01-21 07:23:17 +00:00
|
|
|
|
2024-10-17 17:20:14 +00:00
|
|
|
readonly property real textPixelSize: Math.round(11 * ShellSettings.Settings.statusBarScaleFactor)
|
|
|
|
|
readonly property real smallerTextPixelSize: Math.round(9 * ShellSettings.Settings.statusBarScaleFactor)
|
|
|
|
|
readonly property real elementSpacing: Math.round(Kirigami.Units.smallSpacing * 1.5)
|
2024-01-21 07:23:17 +00:00
|
|
|
|
2025-11-12 21:20:11 +00:00
|
|
|
Clock {
|
|
|
|
|
id: clockSource
|
2021-12-22 23:29:00 +00:00
|
|
|
}
|
2024-01-21 07:23:17 +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
|
|
|
|
|
}
|
|
|
|
|
|
2023-05-13 02:07:48 +00:00
|
|
|
// drop shadow for icons
|
|
|
|
|
MultiEffect {
|
2023-09-29 03:41:18 +00:00
|
|
|
anchors.fill: control
|
2021-04-09 20:59:05 +00:00
|
|
|
visible: showDropShadow
|
2023-09-29 03:41:18 +00:00
|
|
|
source: control
|
2023-05-13 02:07:48 +00:00
|
|
|
blurMax: 16
|
|
|
|
|
shadowEnabled: true
|
|
|
|
|
shadowVerticalOffset: 1
|
|
|
|
|
shadowOpacity: 0.8
|
2021-04-09 20:59:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// screen top panel
|
2023-09-29 03:41:18 +00:00
|
|
|
Controls.Control {
|
|
|
|
|
id: control
|
2021-04-09 20:59:05 +00:00
|
|
|
z: 1
|
2023-09-29 03:41:18 +00:00
|
|
|
topPadding: Kirigami.Units.smallSpacing
|
|
|
|
|
bottomPadding: Kirigami.Units.smallSpacing
|
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
|
|
|
rightPadding: Kirigami.Units.smallSpacing * 3 + panelSettings.statusBarLeftPadding
|
2025-12-23 01:36:18 +00:00
|
|
|
leftPadding: Kirigami.Units.smallSpacing * 3 + panelSettings.statusBarRightPadding
|
2023-09-29 03:41:18 +00:00
|
|
|
|
2021-04-09 20:59:05 +00:00
|
|
|
anchors.fill: parent
|
2023-09-29 03:41:18 +00:00
|
|
|
background: Rectangle {
|
|
|
|
|
id: panelBackground
|
|
|
|
|
color: backgroundColor
|
|
|
|
|
}
|
2023-03-19 05:06:48 +00:00
|
|
|
|
2023-09-29 03:41:18 +00:00
|
|
|
contentItem: ColumnLayout {
|
|
|
|
|
spacing: Kirigami.Units.smallSpacing / 2
|
2021-10-12 13:50:36 +00:00
|
|
|
|
2023-09-29 03:41:18 +00:00
|
|
|
RowLayout {
|
|
|
|
|
id: mainRow
|
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
|
|
|
readonly property real rowHeight: MobileShell.Constants.defaultTopPanelHeight - Kirigami.Units.smallSpacing * 2
|
2023-09-29 03:41:18 +00:00
|
|
|
|
|
|
|
|
Layout.fillWidth: true
|
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
|
|
|
Layout.alignment: Qt.AlignVCenter
|
2023-09-29 03:41:18 +00:00
|
|
|
Layout.preferredHeight: rowHeight
|
|
|
|
|
|
|
|
|
|
spacing: 0
|
|
|
|
|
|
|
|
|
|
// clock
|
|
|
|
|
ClockText {
|
|
|
|
|
visible: root.showTime
|
|
|
|
|
Layout.fillHeight: true
|
2024-06-28 02:05:42 +00:00
|
|
|
fontPixelSize: textPixelSize
|
2025-11-12 21:20:11 +00:00
|
|
|
clockSource: clockSource
|
2023-09-29 03:41:18 +00:00
|
|
|
}
|
|
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.SignalStrengthIndicator {
|
2023-09-29 03:41:18 +00:00
|
|
|
Layout.fillHeight: true
|
|
|
|
|
showLabel: true
|
|
|
|
|
visible: !root.showTime
|
|
|
|
|
textPixelSize: root.textPixelSize
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// spacing in the middle
|
|
|
|
|
Item {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// system indicators
|
|
|
|
|
// using Layout.fillHeight here seems to cause polish loops, instead just define the height of the row
|
2021-10-12 13:50:36 +00:00
|
|
|
RowLayout {
|
2023-09-29 03:41:18 +00:00
|
|
|
id: indicators
|
|
|
|
|
Layout.leftMargin: Kirigami.Units.smallSpacing // applets have different spacing needs
|
|
|
|
|
Layout.maximumHeight: mainRow.rowHeight
|
|
|
|
|
|
|
|
|
|
spacing: root.elementSpacing
|
|
|
|
|
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.SignalStrengthIndicator {
|
2023-09-29 03:41:18 +00:00
|
|
|
showLabel: false
|
2021-12-22 23:29:00 +00:00
|
|
|
visible: root.showTime
|
2023-09-29 03:41:18 +00:00
|
|
|
internetIndicator: internetIndicatorItem
|
|
|
|
|
implicitHeight: mainRow.rowHeight
|
|
|
|
|
Layout.preferredWidth: height
|
|
|
|
|
}
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.BluetoothIndicator {
|
2023-09-29 03:41:18 +00:00
|
|
|
implicitHeight: mainRow.rowHeight
|
|
|
|
|
Layout.preferredWidth: height
|
|
|
|
|
}
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.InternetIndicator {
|
2023-09-29 03:41:18 +00:00
|
|
|
id: internetIndicatorItem
|
|
|
|
|
implicitHeight: mainRow.rowHeight
|
|
|
|
|
Layout.preferredWidth: height
|
2021-10-12 13:50:36 +00:00
|
|
|
}
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.VolumeIndicator {
|
2023-09-29 03:41:18 +00:00
|
|
|
implicitHeight: mainRow.rowHeight
|
|
|
|
|
Layout.preferredWidth: height
|
|
|
|
|
}
|
2023-11-02 11:08:17 +00:00
|
|
|
MobileShell.BatteryIndicator {
|
2023-09-29 03:41:18 +00:00
|
|
|
spacing: root.elementSpacing
|
|
|
|
|
textPixelSize: root.textPixelSize
|
|
|
|
|
implicitHeight: mainRow.rowHeight
|
|
|
|
|
Layout.preferredWidth: height
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// extra row with date and mobile provider (for quicksettings panel)
|
|
|
|
|
RowLayout {
|
|
|
|
|
spacing: 0
|
|
|
|
|
visible: root.showSecondRow
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
2025-11-12 21:20:11 +00:00
|
|
|
text: Qt.formatDate(clockSource.dateTime, "ddd. MMMM d")
|
2023-09-29 03:41:18 +00:00
|
|
|
color: Kirigami.Theme.disabledTextColor
|
|
|
|
|
font.pixelSize: root.smallerTextPixelSize
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Item { Layout.fillWidth: true }
|
|
|
|
|
|
|
|
|
|
PlasmaComponents.Label {
|
|
|
|
|
visible: root.showTime
|
2023-10-19 17:46:54 +00:00
|
|
|
text: MobileShell.SignalStrengthInfo.label
|
2023-09-29 03:41:18 +00:00
|
|
|
color: Kirigami.Theme.disabledTextColor
|
|
|
|
|
font.pixelSize: root.smallerTextPixelSize
|
|
|
|
|
horizontalAlignment: Qt.AlignRight
|
2021-07-14 16:21:31 +00:00
|
|
|
}
|
|
|
|
|
}
|
2021-04-09 20:59:05 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|