Files
mxandClaude Opus 5.5 0dcf37346c Add a Caffeine inhibitor, app stream volumes and vertical bar sliders
CaffeineService holds a systemd-inhibit idle/sleep lock while active.
AudioService lists app playback streams and tracks their volume only
while a view holds a Demand on it. GlassBarSlider fills from the bottom
when vertical.

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

74 lines
3.0 KiB
QML

import QtQuick
import QtQuick.Controls
import "../theme"
// Thick pill slider with an icon inside the track (macOS Control Center style).
// Vertical sliders fill from the bottom with the icon at the foot.
Slider {
id: root
property string glyph
property string fallback
implicitWidth: vertical ? 28 : 220
implicitHeight: vertical ? 220 : 28
padding: 0
background: Rectangle {
x: root.leftPadding
y: root.topPadding + (root.vertical ? 0 : root.availableHeight / 2 - height / 2)
width: root.availableWidth
height: root.availableHeight
radius: Math.min(width, height) / 2
color: Theme.surfaceVariant
border.width: root.activeFocus ? 1 : 0
border.color: Theme.accent
Rectangle {
readonly property real knob: root.vertical ? parent.width : parent.height
readonly property real length: Math.max(knob, knob + root.position * ((root.vertical ? parent.height : parent.width) - knob))
y: root.vertical ? parent.height - height : 0
width: root.vertical ? parent.width : length
height: root.vertical ? length : parent.height
radius: knob / 2
color: root.enabled ? Qt.alpha(Theme.text, 0.92) : Qt.alpha(Theme.text, 0.35)
Behavior on width {
enabled: !root.pressed && !root.vertical
NumberAnimation {
duration: Theme.duration / 2
easing.type: Easing.OutCubic
}
}
Behavior on height {
enabled: !root.pressed && root.vertical
NumberAnimation {
duration: Theme.duration / 2
easing.type: Easing.OutCubic
}
}
}
Text {
readonly property real knob: root.vertical ? parent.width : parent.height
x: root.vertical ? (parent.width - width) / 2 : (knob - width) / 2
y: root.vertical ? parent.height - knob / 2 - height / 2 : (parent.height - height) / 2
text: Icons.available && root.glyph ? root.glyph : root.fallback
font.family: Icons.available && root.glyph ? Icons.family : ""
font.pixelSize: Math.round(knob * 0.5)
color: Theme.surface
}
}
handle: Rectangle {
readonly property real knob: root.vertical ? root.availableWidth : root.availableHeight
x: root.leftPadding + (root.vertical ? 0 : root.visualPosition * (root.availableWidth - width))
y: root.topPadding + (root.vertical ? root.visualPosition * (root.availableHeight - height) : root.availableHeight / 2 - height / 2)
width: knob
height: knob
radius: width / 2
color: root.enabled ? Theme.text : Qt.alpha(Theme.text, 0.5)
border.width: 1
border.color: Qt.alpha(Theme.surface, 0.5)
scale: root.pressed ? 1.06 : 1
Behavior on scale {
NumberAnimation {
duration: Theme.duration / 2
}
}
}
}