diff --git a/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml b/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml --- a/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml +++ b/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml @@ -21,14 +21,16 @@ import QtQuick 2.0 import QtQuick.Layouts 1.1 +import QtGraphicalEffects 1.12 import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.components 2.0 as Components import org.kde.plasma.workspace.components 2.0 MouseArea { id: root Layout.minimumWidth: units.iconSizes.small * view.count Layout.minimumHeight: units.iconSizes.small + hoverEnabled: true property real itemSize: Math.min(root.height, root.width/view.count) onClicked: plasmoid.expanded = !plasmoid.expanded @@ -58,21 +60,40 @@ property real iconSize: Math.min(width, height) - BatteryIcon { - id: batteryIcon - anchors.centerIn: parent - hasBattery: batteryContainer.hasBattery - percent: batteryContainer.percent - pluggedIn: batteryContainer.pluggedIn - height: isConstrained ? batteryContainer.iconSize : batteryContainer.iconSize - batteryLabel.height - width: height + Item { + id: batteryItem + + anchors.fill: batteryContainer + + BatteryIcon { + id: batteryIcon + anchors.centerIn: parent + hasBattery: batteryContainer.hasBattery + percent: batteryContainer.percent + pluggedIn: batteryContainer.pluggedIn + height: batteryContainer.iconSize + width: height + } + + BadgeOverlay { + anchors.fill: batteryIcon + text: batteryContainer.hasBattery ? i18nc("battery percentage below battery icon", "%1%", percent) : i18nc("short symbol to signal there is no battery currently available", "-") + icon: batteryIcon + visible: plasmoid.configuration.showPercentage + } } - BadgeOverlay { - anchors.fill: batteryIcon - text: batteryContainer.hasBattery ? i18nc("battery percentage below battery icon", "%1%", percent) : i18nc("short symbol to signal there is no battery currently available", "-") - icon: batteryIcon - visible: plasmoid.configuration.showPercentage + GammaAdjust { + anchors.fill: batteryItem + source: batteryItem + gamma: root.containsMouse ? (1.0 / 0.7) : 1 + + Behavior on gamma { + PropertyAnimation { + easing: Easing.InOutQuad + duration: 250 + } + } } } }