Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
2.8 KiB
QML
84 lines
2.8 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import "../../components"
|
|
import "../../core"
|
|
import "../../services"
|
|
import "../../theme"
|
|
|
|
// Cava audio visualizer in the bar. Click opens the dashboard's Media tab,
|
|
// right-click the Media settings. Cava only runs while something plays.
|
|
GlassPill {
|
|
id: root
|
|
objectName: "cavaPill"
|
|
readonly property var options: ConfigService.ready ? ConfigService.data.bar.cava : ({
|
|
bars: 12,
|
|
style: "bars",
|
|
hideWhenIdle: true
|
|
})
|
|
readonly property bool mirror: options.style === "mirror"
|
|
readonly property bool shown: !CavaService.failed && (MediaService.playing || !options.hideWhenIdle)
|
|
readonly property int barWidth: 3
|
|
readonly property int gap: 2
|
|
implicitHeight: ModuleRegistry.pillHeight
|
|
implicitWidth: shown ? options.bars * barWidth + (options.bars - 1) * gap + 22 : 0
|
|
visible: implicitWidth > 0.5
|
|
opacity: shown ? 1 : 0
|
|
clip: true
|
|
Behavior on implicitWidth {
|
|
NumberAnimation {
|
|
duration: Theme.duration * 1.4
|
|
easing.type: Easing.OutCubic
|
|
}
|
|
}
|
|
Behavior on opacity {
|
|
NumberAnimation {
|
|
duration: Theme.duration
|
|
}
|
|
}
|
|
Component.onCompleted: CavaService.widgetConsumers++
|
|
Component.onDestruction: CavaService.widgetConsumers--
|
|
// Cava emits 24 bands; each pill bar averages its share of them.
|
|
function level(index) {
|
|
const all = CavaService.bars, n = options.bars, from = Math.floor(index * all.length / n), to = Math.max(from + 1, Math.floor((index + 1) * all.length / n));
|
|
let sum = 0;
|
|
for (let i = from; i < to; i++)
|
|
sum += all[i] || 0;
|
|
return sum / (to - from);
|
|
}
|
|
Row {
|
|
anchors.centerIn: parent
|
|
height: parent.height - 12
|
|
spacing: root.gap
|
|
Repeater {
|
|
model: root.options.bars
|
|
Rectangle {
|
|
required property int index
|
|
readonly property real value: MediaService.playing ? Math.min(1, root.level(index)) : 0
|
|
width: root.barWidth
|
|
radius: width / 2
|
|
height: Math.max(width, parent.height * value)
|
|
y: root.mirror ? (parent.height - height) / 2 : parent.height - height
|
|
color: Theme.accentVivid
|
|
opacity: 0.55 + 0.45 * value
|
|
Behavior on height {
|
|
NumberAnimation {
|
|
duration: 80
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
TapHandler {
|
|
acceptedButtons: Qt.LeftButton
|
|
onTapped: ShellState.toggleDashboard("media")
|
|
}
|
|
TapHandler {
|
|
acceptedButtons: Qt.RightButton
|
|
onTapped: ShellState.openSettings("media")
|
|
}
|
|
HoverHandler {
|
|
cursorShape: Qt.PointingHandCursor
|
|
}
|
|
Accessible.name: "Audio visualizer"
|
|
}
|