nosignal-shell/modules/bar/components/StatusIcons.qml
2 * r + 2 * t 89bb774012 refactor: manually animate rect if needed
No need for animate prop, it's used too little so just manually set it if needed to save memory
2025-05-10 18:49:10 +10:00

76 lines
2 KiB
QML

import "root:/widgets"
import "root:/services"
import "root:/utils"
import "root:/config"
import Quickshell
import QtQuick
StyledRect {
id: root
property color colour: Colours.palette.rosewater
clip: true
MaterialIcon {
id: network
animate: true
text: Icons.getNetworkIcon(Network.active?.strength ?? 0)
color: root.colour
anchors.horizontalCenter: root.vertical ? parent.horizontalCenter : undefined
}
AnchorText {
id: bluetooth
prevAnchor: network
animate: true
text: Bluetooth.powered ? "bluetooth" : "bluetooth_disabled"
color: root.colour
font.family: Appearance.font.family.material
font.pointSize: Appearance.font.size.larger
}
Box {
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
Repeater {
model: ScriptModel {
values: Bluetooth.devices.filter(d => d.connected)
}
MaterialIcon {
required property Bluetooth.Device modelData
animate: true
text: Icons.getBluetoothIcon(modelData.icon)
color: root.colour
}
}
}
Behavior on implicitWidth {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasized
}
}
Behavior on implicitHeight {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasized
}
}
}