import QtQuick
import org.kde.kirigami as Kirigami
import "Vigil.js" as Vigil
// One health dot. Failing pulses a halo, so it catches the eye at panel
// size; not loaded yet is a hollow ring.
Item {
id: circle
property string health: "unknown"
property bool highlighted: false
property bool dimmed: false
readonly property color healthColor: Vigil.healthColor(health)
implicitWidth: Kirigami.Units.iconSizes.small
implicitHeight: implicitWidth
opacity: dimmed ? 0.5 : 1
Rectangle {
id: halo
anchors.centerIn: parent
width: parent.width
height: width
radius: width / 2
color: "transparent"
border.color: circle.healthColor
border.width: 1
opacity: 0
visible: circle.health === "failing" && !circle.dimmed
SequentialAnimation on opacity {
running: halo.visible
loops: Animation.Infinite
NumberAnimation { from: 0.8; to: 0; duration: 1600; easing.type: Easing.OutQuad }
PauseAnimation { duration: 1400 }
}
SequentialAnimation on scale {
running: halo.visible
loops: Animation.Infinite
NumberAnimation { from: 0.7; to: 1.35; duration: 1600; easing.type: Easing.OutQuad }
PauseAnimation { duration: 1400 }
}
}
Rectangle {
anchors.centerIn: parent
width: parent.width * (circle.highlighted ? 0.9 : 0.72)
height: width
radius: width / 2
color: circle.health === "unknown" ? "transparent" : circle.healthColor
border.color: circle.healthColor
border.width: circle.health === "unknown" ? Math.max(1.5, width / 6) : 0
Behavior on width { NumberAnimation { duration: Kirigami.Units.shortDuration } }
Behavior on color { ColorAnimation { duration: Kirigami.Units.longDuration } }
}
}
neiam
/vigil-plasmoid
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
1.9 KiB · text
History
905ae26