summaryrefslogtreecommitdiff
path: root/modules/bar/components/StatusIcons.qml
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-27 10:42:08 +0800
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-05-27 10:42:08 +0800
commit63da636144635e5aa6b7ff1a2d2eec2a1e35aafa (patch)
treecd5461058c7afedb2d17f474f13ee218759519ba /modules/bar/components/StatusIcons.qml
parentdrawers: dont use hyprland cursor pos (diff)
downloadcaelestia-shell-63da636144635e5aa6b7ff1a2d2eec2a1e35aafa.tar.gz
caelestia-shell-63da636144635e5aa6b7ff1a2d2eec2a1e35aafa.tar.bz2
caelestia-shell-63da636144635e5aa6b7ff1a2d2eec2a1e35aafa.zip
internal: bar only vertical
The bar can only be vertical Remove box, boxlayout and anchortext Add StyledClippingRect
Diffstat (limited to 'modules/bar/components/StatusIcons.qml')
-rw-r--r--modules/bar/components/StatusIcons.qml41
1 files changed, 16 insertions, 25 deletions
diff --git a/modules/bar/components/StatusIcons.qml b/modules/bar/components/StatusIcons.qml
index a6ad443..453adf0 100644
--- a/modules/bar/components/StatusIcons.qml
+++ b/modules/bar/components/StatusIcons.qml
@@ -9,12 +9,11 @@ import QtQuick
Item {
id: root
- readonly property bool vertical: parent?.vertical ?? false
property color colour: Colours.palette.m3secondary
clip: true
- implicitWidth: vertical ? Math.max(network.implicitWidth, bluetooth.implicitWidth, devices.implicitWidth, battery.implicitWidth) : network.implicitWidth + bluetooth.implicitWidth + bluetooth.anchors.leftMargin + (repeater.count > 0 ? devices.implicitWidth + devices.anchors.leftMargin : 0) + (battery.active ? battery.implicitWidth + battery.anchors.leftMargin : 0)
- implicitHeight: vertical ? network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) + (battery.active ? battery.implicitHeight + battery.anchors.topMargin : 0) : Math.max(network.implicitHeight, bluetooth.implicitHeight, devices.implicitHeight, battery.implicitHeight)
+ implicitWidth: Math.max(network.implicitWidth, bluetooth.implicitWidth, devices.implicitWidth, battery.implicitWidth)
+ implicitHeight: network.implicitHeight + bluetooth.implicitHeight + bluetooth.anchors.topMargin + (repeater.count > 0 ? devices.implicitHeight + devices.anchors.topMargin : 0) + (battery.active ? battery.implicitHeight + battery.anchors.topMargin : 0)
MaterialIcon {
id: network
@@ -23,31 +22,27 @@ Item {
text: Icons.getNetworkIcon(Network.active?.strength ?? 0)
color: root.colour
- anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
+ anchors.horizontalCenter: parent.horizontalCenter
}
- AnchorText {
+ MaterialIcon {
id: bluetooth
- prevAnchor: network
+ anchors.horizontalCenter: network.horizontalCenter
+ anchors.top: network.bottom
+ anchors.topMargin: Appearance.spacing.small
animate: true
text: Bluetooth.powered ? "bluetooth" : "bluetooth_disabled"
color: root.colour
- font.family: Appearance.font.family.material
- font.pointSize: Appearance.font.size.larger
}
- Box {
+ Column {
id: devices
- anchors.left: vertical ? undefined : bluetooth.right
- anchors.leftMargin: vertical ? 0 : Appearance.padding.smaller
- anchors.top: vertical ? bluetooth.bottom : undefined
- anchors.topMargin: vertical ? Appearance.padding.smaller : 0
-
- anchors.horizontalCenter: vertical ? bluetooth.horizontalCenter : undefined
- anchors.verticalCenter: vertical ? undefined : bluetooth.verticalCenter
+ anchors.horizontalCenter: bluetooth.horizontalCenter
+ anchors.top: bluetooth.bottom
+ anchors.topMargin: Appearance.spacing.small
Repeater {
id: repeater
@@ -69,13 +64,9 @@ Item {
Loader {
id: battery
- anchors.left: root.vertical ? undefined : repeater.count > 0 ? devices.right : bluetooth.right
- anchors.leftMargin: root.vertical ? 0 : Appearance.padding.smaller
- anchors.top: root.vertical ? repeater.count > 0 ? devices.bottom : bluetooth.bottom : undefined
- anchors.topMargin: root.vertical ? Appearance.padding.smaller : 0
-
- anchors.horizontalCenter: root.vertical ? devices.horizontalCenter : undefined
- anchors.verticalCenter: root.vertical ? undefined : devices.verticalCenter
+ anchors.horizontalCenter: devices.horizontalCenter
+ anchors.top: repeater.count > 0 ? devices.bottom : bluetooth.bottom
+ anchors.topMargin: Appearance.spacing.small
active: UPower.displayDevice.isLaptopBattery
asynchronous: true
@@ -84,7 +75,7 @@ Item {
text: {
const device = UPower.displayDevice;
const perc = device.percentage;
- const charging = device.changeRate >= 0;
+ const charging = device.changeRate > 0;
if (perc === 1)
return charging ? "battery_charging_full" : "battery_full";
let level = Math.floor(perc * 7);
@@ -92,7 +83,7 @@ Item {
level--;
return charging ? `battery_charging_${(level + 3) * 10}` : `battery_${level}_bar`;
}
- color: UPower.displayDevice.percentage > 0.2 ? root.colour : Colours.palette.m3error
+ color: UPower.displayDevice.percentage > 0.2 || UPower.displayDevice.changeRate > 0 ? root.colour : Colours.palette.m3error
fill: 1
}
}