Compare commits

..

No commits in common. "5f3864afbad3b2cf8571843d1b11d3535cb33a2d" and "160937e674cd5bd57f83f3b23de7b71336f87608" have entirely different histories.

3 changed files with 13 additions and 52 deletions

View file

@ -27,18 +27,6 @@ PanelWindow {
opacity: M.Theme.barOpacity opacity: M.Theme.barOpacity
} }
Rectangle {
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 3
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop { position: 0; color: M.Theme.base0C }
GradientStop { position: 1; color: M.Theme.base09 }
}
}
Item { Item {
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: M.Theme.barPadding anchors.leftMargin: M.Theme.barPadding

View file

@ -2,33 +2,20 @@ import QtQuick
import QtQuick.Effects import QtQuick.Effects
import "." as M import "." as M
Item { Rectangle {
id: root id: root
default property alias content: row.children default property alias content: row.children
property color borderColor: M.Theme.base02 property color borderColor: M.Theme.base02
color: "transparent"
border.color: borderColor
border.width: 1
radius: M.Theme.radius
visible: row.visibleChildren.length > 0 visible: row.visibleChildren.length > 0
implicitWidth: row.implicitWidth + _pad * 2 layer.enabled: true
implicitHeight: row.implicitHeight + _pad * 2 layer.effect: MultiEffect {
readonly property int _pad: 6
// Shadow source rendered offscreen, only its glow is visible
Rectangle {
id: shadowSource
anchors.fill: parent
color: "transparent"
border.color: root.borderColor
border.width: 1
radius: M.Theme.radius
visible: false
}
MultiEffect {
source: shadowSource
anchors.fill: shadowSource
shadowEnabled: true shadowEnabled: true
shadowColor: root.borderColor shadowColor: root.borderColor
shadowBlur: 0.6 shadowBlur: 0.6
@ -36,14 +23,10 @@ Item {
shadowHorizontalOffset: 0 shadowHorizontalOffset: 0
} }
// Visible border (on top of the glow) implicitWidth: row.implicitWidth + _pad * 2
Rectangle { implicitHeight: row.implicitHeight + _pad * 2
anchors.fill: parent
color: "transparent" readonly property int _pad: 6
border.color: root.borderColor
border.width: 1
radius: M.Theme.radius
}
Row { Row {
id: row id: row

View file

@ -18,17 +18,9 @@ M.BarSection {
readonly property var dev: UPower.displayDevice readonly property var dev: UPower.displayDevice
readonly property real pct: (dev?.percentage ?? 0) * 100 readonly property real pct: (dev?.percentage ?? 0) * 100
readonly property bool charging: dev?.state === UPowerDeviceState.Charging readonly property bool charging: dev?.state === UPowerDeviceState.Charging
readonly property bool _critical: pct < 15 && !charging property color _stateColor: charging ? M.Theme.base0B : pct < 15 ? M.Theme.base09 : pct < 30 ? M.Theme.base0A : M.Theme.base08
property color _stateColor: charging ? M.Theme.base0B : _critical ? M.Theme.base09 : pct < 30 ? M.Theme.base0A : M.Theme.base08
property real _blinkOpacity: 1
SequentialAnimation { Behavior on _stateColor { ColorAnimation { duration: 300 } }
running: root._critical
loops: Animation.Infinite
NumberAnimation { target: root; property: "_blinkOpacity"; to: 0.2; duration: 400; easing.type: Easing.InOutQuad }
NumberAnimation { target: root; property: "_blinkOpacity"; to: 1; duration: 400; easing.type: Easing.InOutQuad }
onRunningChanged: if (!running) root._blinkOpacity = 1
}
property bool _warnSent: false property bool _warnSent: false
property bool _critSent: false property bool _critSent: false
@ -57,14 +49,12 @@ M.BarSection {
return icons[Math.min(10, Math.floor(root.pct / 10))]; return icons[Math.min(10, Math.floor(root.pct / 10))];
} }
color: root._stateColor color: root._stateColor
opacity: root._blinkOpacity
font.pixelSize: M.Theme.fontSize + 2 font.pixelSize: M.Theme.fontSize + 2
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
M.BarLabel { M.BarLabel {
label: Math.round(root.pct) + "%" label: Math.round(root.pct) + "%"
color: root._stateColor color: root._stateColor
opacity: root._blinkOpacity
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
} }