mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
4cbb0f23c6
Comment on Discussion When sdata/dist-arch/ Changes / comment_on_discussion (push) Waiting to run
82 lines
2.2 KiB
QML
82 lines
2.2 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
import Quickshell.Widgets
|
|
import qs.modules.common
|
|
import qs.modules.common.widgets
|
|
|
|
Slider {
|
|
id: root
|
|
|
|
property real trackWidth: 4
|
|
// leftPadding: handle.width / 2
|
|
// rightPadding: handle.width / 2
|
|
leftPadding: 0
|
|
rightPadding: 0
|
|
|
|
implicitHeight: handle.implicitHeight
|
|
|
|
Behavior on value { // This makes the adjusted value (like volume) shift smoothly
|
|
SmoothedAnimation {
|
|
velocity: Looks.transition.velocity
|
|
}
|
|
}
|
|
|
|
background: Item {
|
|
id: background
|
|
anchors.fill: parent
|
|
|
|
Rectangle {
|
|
id: trackHighlight
|
|
anchors {
|
|
left: parent.left
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
topLeftRadius: root.trackWidth / 2
|
|
bottomLeftRadius: root.trackWidth / 2
|
|
color: Looks.colors.accent
|
|
implicitHeight: root.trackWidth
|
|
width: background.width * root.visualPosition
|
|
}
|
|
|
|
Rectangle {
|
|
id: trackTrough
|
|
anchors {
|
|
right: parent.right
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
topRightRadius: root.trackWidth / 2
|
|
bottomRightRadius: root.trackWidth / 2
|
|
color: Looks.colors.controlBg
|
|
implicitHeight: root.trackWidth
|
|
width: background.width * (1 - root.visualPosition)
|
|
}
|
|
}
|
|
|
|
handle: Circle {
|
|
id: handle
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
x: (diameter / 2) + root.visualPosition * (root.width - diameter) - (diameter / 2)
|
|
diameter: 20
|
|
color: Looks.colors.controlFg
|
|
|
|
MouseArea {
|
|
id: handleMouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: true
|
|
acceptedButtons: Qt.NoButton
|
|
}
|
|
|
|
Circle {
|
|
anchors.centerIn: parent
|
|
diameter: root.pressed ? 10 : handleMouseArea.containsMouse ? 14 : 12
|
|
color: Looks.colors.accent
|
|
|
|
Behavior on diameter {
|
|
animation: Looks.transition.enter.createObject(this)
|
|
}
|
|
}
|
|
}
|
|
}
|