Files
dotfiles/quickshell/components/P5Slider.qml
T
nvrlandClaude Opus 5.5 18091a7109 theme: YoRHa dark — NieR:Automata interface on the space-1 wallpaper
Replaces the Persona x Mocha rice. NieR's menu language is kept whole —
plain rectangles, hairline rules, letter-spaced upright capitals, a square
marker on the current row, corner ticks round panels, and selection shown
by inverting the row — but the colours come from ~/.wallpapers/space-1.jpg
rather than from the game's beige: the grey-green void as the ground, the
suit's sage grey as text, the planet's white as the one accent, and the
hull's red indicator lights as the alarm.

The Persona geometry is switched off rather than ripped out: Theme.skew
and Theme.cut are 0, so P5Panel, Skew and Geom collapse to rectangles.
Overshoot easing, italics and black weights are gone shell-wide.

New, borrowed from caelestia's screen border: bar/Frame.qml draws the bar,
the rail and a thin left/bottom band as one hull on the bottom layer, with
the desktop as a rounded opening cut out of it. Frame also owns all four
exclusive zones, so the bar and rail are placed from the screen edge.

Hyprland moves to 1px borders lit from the planet white into grey, a soft
wide shadow and gaps measured from the opening. Alacritty, fish and dunst
get matching YoRHa palettes. Neovim, GTK/Qt and btop are still Mocha.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 20:10:53 +02:00

130 lines
3.6 KiB
QML

import QtQuick
import "root:/config"
import "root:/components"
// Hairline slider with a square handle, the NieR settings-menu slider. Drag or
// click anywhere on the rail.
Item {
id: root
property real value: 0 // 0..1
property color accent: Theme.primary
property real stepSize: 0.05
signal moved(real value)
implicitHeight: 18
implicitWidth: 200
focusPolicy: root.enabled ? Qt.StrongFocus : Qt.NoFocus
readonly property real _lean: Theme.skew * height
function commit(nextValue: real): void {
if (!root.enabled)
return;
root.moved(Math.max(0, Math.min(1, nextValue)));
}
// Rail
Skew {
id: rail
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.right: parent.right
height: root.activeFocus ? 4 : 2
// Focus widens the rail and rings it in the accent rather than filling
// it: the level fill is often the accent itself, and a solid accent
// rail swallowed it.
color: root.activeFocus
? Theme.surfaceAlt
: Theme.alpha(root.enabled ? Theme.outline : Theme.treatmentDisabledMark, 0.7)
borderColor: root.activeFocus ? Theme.accent : "transparent"
borderWidth: root.activeFocus ? Theme.stroke : 0
Behavior on height {
NumberAnimation { duration: Theme.durFast }
}
}
// Fill
Skew {
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
width: Math.max(0, Math.min(1, root.value)) * root.width
height: root.activeFocus ? 4 : 2
color: root.enabled ? root.accent : Theme.treatmentDisabledText
Behavior on width {
enabled: !drag.active
NumberAnimation { duration: Theme.durFast }
}
Behavior on color {
ColorAnimation { duration: Theme.durBase }
}
}
// Handle
Skew {
id: handle
width: height
height: root.activeFocus || hover.hovered || drag.active ? 12 : 10
color: root.enabled ? Theme.text : Theme.treatmentDisabledText
anchors.verticalCenter: parent.verticalCenter
x: Math.max(0, Math.min(1, root.value)) * root.width - width / 2
Behavior on height {
NumberAnimation { duration: Theme.durFast; easing.type: Easing.OutCubic }
}
Behavior on x {
enabled: !drag.active
NumberAnimation { duration: Theme.durFast }
}
}
HoverHandler {
id: hover
enabled: root.enabled
cursorShape: Qt.PointingHandCursor
}
TapHandler {
enabled: root.enabled
onPressedChanged: if (pressed) root.forceActiveFocus(Qt.MouseFocusReason)
onTapped: event => root.commit(event.position.x / root.width)
}
DragHandler {
id: drag
enabled: root.enabled
target: null
xAxis.enabled: true
yAxis.enabled: false
onCentroidChanged: {
if (!active) return;
root.forceActiveFocus(Qt.MouseFocusReason);
root.commit(centroid.position.x / root.width);
}
}
Keys.onPressed: event => {
switch (event.key) {
case Qt.Key_Left:
root.commit(root.value - root.stepSize);
break;
case Qt.Key_Right:
root.commit(root.value + root.stepSize);
break;
case Qt.Key_Home:
root.commit(0);
break;
case Qt.Key_End:
root.commit(1);
break;
default:
return;
}
event.accepted = true;
}
}