Nix-Vibe public snapshot (squashed history)
Current state of main at 0240060 feat(hp-laptop): install TeleportFling from its flake. History intentionally collapsed to a single commit; this repo mirrors only the latest state.
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
// SciSlider.qml — themed slider for the quick-settings panel.
|
||||
// Imperative two-way use: set `.value` from the outside, read `.moved(v)`.
|
||||
// (Avoids QML binding loops with live PipeWire/brightness state.)
|
||||
import QtQuick
|
||||
|
||||
Item {
|
||||
id: slider
|
||||
|
||||
implicitHeight: 24
|
||||
|
||||
property real value: 0.5 // 0..1
|
||||
property color accent: "#00e5ff"
|
||||
property color trackColor: "#24283b"
|
||||
readonly property bool pressed: mouseArea.pressed
|
||||
|
||||
signal moved(real v)
|
||||
|
||||
function setFromMouse(mx) {
|
||||
if (width <= 0)
|
||||
return;
|
||||
let v = mx / width;
|
||||
if (v < 0)
|
||||
v = 0;
|
||||
if (v > 1)
|
||||
v = 1;
|
||||
if (v !== slider.value) {
|
||||
slider.value = v;
|
||||
slider.moved(v);
|
||||
}
|
||||
}
|
||||
|
||||
// track
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: parent.width
|
||||
height: 6
|
||||
radius: 3
|
||||
color: slider.trackColor
|
||||
border.color: "#394b70"
|
||||
border.width: 1
|
||||
}
|
||||
|
||||
// filled portion
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
width: slider.value * parent.width
|
||||
height: 6
|
||||
radius: 3
|
||||
color: slider.accent
|
||||
}
|
||||
|
||||
// knob
|
||||
Rectangle {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: slider.value * (parent.width - width)
|
||||
width: 14
|
||||
height: 14
|
||||
radius: 7
|
||||
color: slider.pressed ? "#ffffff" : slider.accent
|
||||
border.color: "#0b0e14"
|
||||
border.width: 1
|
||||
Behavior on color { ColorAnimation { duration: 120 } }
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors {
|
||||
fill: parent
|
||||
topMargin: -6
|
||||
bottomMargin: -6
|
||||
}
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
hoverEnabled: true
|
||||
onPressed: mouse => slider.setFromMouse(mouse.x)
|
||||
onPositionChanged: mouse => {
|
||||
if (pressed)
|
||||
slider.setFromMouse(mouse.x);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user