quickshell: sliding selection pill for power profile buttons
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
bfcc54d0db
commit
9a38cacc05
1 changed files with 68 additions and 42 deletions
|
|
@ -1749,8 +1749,32 @@ in
|
||||||
font.pixelSize: 11
|
font.pixelSize: 11
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Item {
|
||||||
width: parent.width
|
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
|
spacing: 4
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
|
|
@ -1765,12 +1789,9 @@ in
|
||||||
width: (parent.width - 8) / 3
|
width: (parent.width - 8) / 3
|
||||||
height: 36
|
height: 36
|
||||||
radius: 6
|
radius: 6
|
||||||
color: batteryWidget.powerProfile === modelData.name
|
color: profMouse.containsMouse && batteryWidget.powerProfile !== modelData.name
|
||||||
? Theme.base02 : profMouse.containsMouse
|
|
||||||
? Theme.base01 : "transparent"
|
? Theme.base01 : "transparent"
|
||||||
Behavior on color { ColorAnimation { duration: 120 } }
|
Behavior on color { ColorAnimation { duration: 120 } }
|
||||||
border.width: batteryWidget.powerProfile === modelData.name ? 1 : 0
|
|
||||||
border.color: Theme.base03
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
@ -1780,13 +1801,16 @@ in
|
||||||
text: modelData.label
|
text: modelData.label
|
||||||
color: batteryWidget.powerProfile === modelData.name
|
color: batteryWidget.powerProfile === modelData.name
|
||||||
? Theme.base0D : Theme.base05
|
? Theme.base0D : Theme.base05
|
||||||
|
Behavior on color { ColorAnimation { duration: 200 } }
|
||||||
font.family: Theme.fontFamily
|
font.family: Theme.fontFamily
|
||||||
font.pixelSize: 14
|
font.pixelSize: 14
|
||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
text: modelData.tip
|
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.family: Theme.fontFamily
|
||||||
font.pixelSize: 9
|
font.pixelSize: 9
|
||||||
}
|
}
|
||||||
|
|
@ -1796,6 +1820,7 @@ in
|
||||||
id: profMouse
|
id: profMouse
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: PowerProfiles.profile = modelData.profile
|
onClicked: PowerProfiles.profile = modelData.profile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1803,6 +1828,7 @@ in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
// Calendar popup — GNOME-style two-pane panel.
|
// Calendar popup — GNOME-style two-pane panel.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue