quickshell: sliding selection pill for power profile buttons

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
rope 2026-06-12 10:23:35 +01:00
parent bfcc54d0db
commit 9a38cacc05

View file

@ -1749,8 +1749,32 @@ in
font.pixelSize: 11
}
Row {
Item {
width: parent.width
height: 36
// Sliding selection pill glides between
// profiles instead of each button flipping.
Rectangle {
id: profilePill
readonly property int selIdx:
batteryWidget.powerProfile === "power-saver" ? 0
: batteryWidget.powerProfile === "performance" ? 2
: 1
width: (parent.width - 8) / 3
height: 36
radius: 6
color: Theme.base02
border.width: 1
border.color: Theme.base03
x: selIdx * (width + 4)
Behavior on x {
NumberAnimation { duration: 250; easing.type: Easing.OutExpo }
}
}
Row {
anchors.fill: parent
spacing: 4
Repeater {
@ -1765,12 +1789,9 @@ in
width: (parent.width - 8) / 3
height: 36
radius: 6
color: batteryWidget.powerProfile === modelData.name
? Theme.base02 : profMouse.containsMouse
color: profMouse.containsMouse && batteryWidget.powerProfile !== modelData.name
? Theme.base01 : "transparent"
Behavior on color { ColorAnimation { duration: 120 } }
border.width: batteryWidget.powerProfile === modelData.name ? 1 : 0
border.color: Theme.base03
Column {
anchors.centerIn: parent
@ -1780,13 +1801,16 @@ in
text: modelData.label
color: batteryWidget.powerProfile === modelData.name
? Theme.base0D : Theme.base05
Behavior on color { ColorAnimation { duration: 200 } }
font.family: Theme.fontFamily
font.pixelSize: 14
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: modelData.tip
color: Theme.base04
color: batteryWidget.powerProfile === modelData.name
? Theme.base05 : Theme.base04
Behavior on color { ColorAnimation { duration: 200 } }
font.family: Theme.fontFamily
font.pixelSize: 9
}
@ -1796,6 +1820,7 @@ in
id: profMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: PowerProfiles.profile = modelData.profile
}
}
@ -1803,6 +1828,7 @@ in
}
}
}
}
''}
// Calendar popup GNOME-style two-pane panel.