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>
This commit is contained in:
1 parent
d6a6cf69f4
commit
0dcf37346c
4 files changed
+94
-18
No files matched your search
@@ -3,30 +3,40 @@ 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: 220
|
||||
implicitHeight: 28
|
||||
implicitWidth: vertical ? 28 : 220
|
||||
implicitHeight: vertical ? 220 : 28
|
||||
padding: 0
|
||||
background: Rectangle {
|
||||
x: root.leftPadding
|
||||
y: root.topPadding + root.availableHeight / 2 - height / 2
|
||||
y: root.topPadding + (root.vertical ? 0 : root.availableHeight / 2 - height / 2)
|
||||
width: root.availableWidth
|
||||
height: root.availableHeight
|
||||
radius: height / 2
|
||||
radius: Math.min(width, height) / 2
|
||||
color: Theme.surfaceVariant
|
||||
border.width: root.activeFocus ? 1 : 0
|
||||
border.color: Theme.accent
|
||||
Rectangle {
|
||||
readonly property real knob: parent.height
|
||||
width: Math.max(knob, knob + root.visualPosition * (parent.width - knob))
|
||||
height: parent.height
|
||||
radius: height / 2
|
||||
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
|
||||
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
|
||||
@@ -34,20 +44,21 @@ Slider {
|
||||
}
|
||||
}
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: (parent.height - width) / 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
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(parent.height * 0.5)
|
||||
font.pixelSize: Math.round(knob * 0.5)
|
||||
color: Theme.surface
|
||||
}
|
||||
}
|
||||
handle: Rectangle {
|
||||
x: root.leftPadding + root.visualPosition * (root.availableWidth - width)
|
||||
y: root.topPadding + root.availableHeight / 2 - height / 2
|
||||
width: root.availableHeight
|
||||
height: root.availableHeight
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user