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>
267 lines
9.6 KiB
QML
267 lines
9.6 KiB
QML
pragma ComponentBehavior: Bound
|
||
import QtQuick
|
||
import QtQuick.Layouts
|
||
import Quickshell
|
||
import Quickshell.Widgets
|
||
import ".."
|
||
import "../../widgets/faces" as Faces
|
||
import "../../services"
|
||
import "../../theme"
|
||
|
||
// User, clock, calendar, resource bars and a compact player.
|
||
Item {
|
||
id: root
|
||
property bool current: false
|
||
implicitWidth: row.implicitWidth
|
||
implicitHeight: row.implicitHeight
|
||
// Collectors only run while this tab is on screen.
|
||
readonly property bool live: current
|
||
property bool subscribed: false
|
||
onLiveChanged: sync()
|
||
Component.onCompleted: sync()
|
||
Component.onDestruction: if (subscribed) {
|
||
MetricsService.consumers--;
|
||
MediaService.progressConsumers--;
|
||
}
|
||
function sync() {
|
||
if (live === subscribed)
|
||
return;
|
||
MetricsService.consumers += live ? 1 : -1;
|
||
MediaService.progressConsumers += live ? 1 : -1;
|
||
subscribed = live;
|
||
}
|
||
readonly property var disk: (MetricsService.snapshot.storage || []).find(s => s.available) || ({})
|
||
|
||
RowLayout {
|
||
id: row
|
||
spacing: 12
|
||
ColumnLayout {
|
||
spacing: 12
|
||
Layout.preferredWidth: 260
|
||
DashCard {
|
||
Layout.fillWidth: true
|
||
Layout.preferredHeight: 112
|
||
Faces.UserFace {
|
||
anchors.fill: parent
|
||
}
|
||
}
|
||
DashCard {
|
||
id: clockCard
|
||
Layout.fillWidth: true
|
||
Layout.preferredHeight: 172
|
||
SystemClock {
|
||
id: clock
|
||
precision: SystemClock.Minutes
|
||
}
|
||
readonly property bool use24: ConfigService.ready && ConfigService.data.bar.clock.use24Hour
|
||
Column {
|
||
anchors.centerIn: parent
|
||
spacing: 2
|
||
Text {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
text: Qt.formatDateTime(clock.date, clockCard.use24 ? "HH:mm" : "h:mm")
|
||
color: Theme.text
|
||
font.pixelSize: 58
|
||
font.weight: Font.Light
|
||
font.features: {
|
||
"tnum": 1
|
||
}
|
||
}
|
||
Text {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
text: Qt.formatDateTime(clock.date, "dddd, d MMMM")
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 13
|
||
}
|
||
}
|
||
}
|
||
}
|
||
DashCard {
|
||
Layout.preferredWidth: 280
|
||
Layout.preferredHeight: 296
|
||
Faces.CalendarFace {
|
||
anchors.fill: parent
|
||
}
|
||
}
|
||
DashCard {
|
||
Layout.preferredWidth: 132
|
||
Layout.preferredHeight: 296
|
||
Row {
|
||
anchors.centerIn: parent
|
||
spacing: 14
|
||
ResourceBar {
|
||
value: MetricsService.cpu.percent
|
||
glyph: ""
|
||
fallback: "C"
|
||
label: "CPU"
|
||
}
|
||
ResourceBar {
|
||
value: MetricsService.ram.percent
|
||
glyph: ""
|
||
fallback: "M"
|
||
label: "Memory"
|
||
}
|
||
ResourceBar {
|
||
value: root.disk.percent
|
||
glyph: ""
|
||
fallback: "D"
|
||
label: "Disk"
|
||
}
|
||
}
|
||
}
|
||
DashCard {
|
||
Layout.preferredWidth: 220
|
||
Layout.preferredHeight: 296
|
||
ColumnLayout {
|
||
anchors.fill: parent
|
||
anchors.margins: 16
|
||
spacing: 8
|
||
ClippingRectangle {
|
||
Layout.alignment: Qt.AlignHCenter
|
||
Layout.preferredWidth: 132
|
||
Layout.preferredHeight: 132
|
||
radius: 18
|
||
color: Theme.fill
|
||
Text {
|
||
anchors.centerIn: parent
|
||
visible: art.status !== Image.Ready
|
||
text: Icons.available ? "" : "♪"
|
||
font.family: Icons.available ? Icons.family : ""
|
||
font.pixelSize: 44
|
||
color: Theme.textSecondary
|
||
}
|
||
Image {
|
||
id: art
|
||
anchors.fill: parent
|
||
source: MediaService.artwork
|
||
sourceSize: Qt.size(264, 264)
|
||
fillMode: Image.PreserveAspectCrop
|
||
asynchronous: true
|
||
opacity: status === Image.Ready ? 1 : 0
|
||
Behavior on opacity {
|
||
NumberAnimation {
|
||
duration: Theme.duration
|
||
}
|
||
}
|
||
}
|
||
}
|
||
Text {
|
||
Layout.fillWidth: true
|
||
text: MediaService.title
|
||
color: Theme.text
|
||
font.pixelSize: 14
|
||
font.weight: Font.DemiBold
|
||
horizontalAlignment: Text.AlignHCenter
|
||
elide: Text.ElideRight
|
||
}
|
||
Text {
|
||
Layout.fillWidth: true
|
||
Layout.topMargin: -6
|
||
text: MediaService.artist
|
||
color: Theme.textSecondary
|
||
font.pixelSize: 12
|
||
horizontalAlignment: Text.AlignHCenter
|
||
elide: Text.ElideRight
|
||
}
|
||
Rectangle {
|
||
Layout.fillWidth: true
|
||
Layout.preferredHeight: 4
|
||
radius: 2
|
||
color: Qt.alpha(Theme.text, 0.12)
|
||
Rectangle {
|
||
width: MediaService.length > 0 && MediaService.length < 7 * 86400 ? parent.width * Math.min(1, MediaService.position / MediaService.length) : 0
|
||
height: parent.height
|
||
radius: 2
|
||
color: Theme.accentVivid
|
||
}
|
||
}
|
||
Row {
|
||
Layout.alignment: Qt.AlignHCenter
|
||
spacing: 10
|
||
DashButton {
|
||
anchors.verticalCenter: parent.verticalCenter
|
||
glyph: ""
|
||
fallback: "‹"
|
||
interactive: !!MediaService.player && MediaService.player.canGoPrevious
|
||
onClicked: MediaService.previous()
|
||
Accessible.name: "Previous track"
|
||
}
|
||
DashButton {
|
||
size: 44
|
||
accented: true
|
||
glyph: MediaService.playing ? "" : ""
|
||
fallback: MediaService.playing ? "Ⅱ" : "▶"
|
||
interactive: !!MediaService.player && MediaService.player.canTogglePlaying
|
||
onClicked: MediaService.toggle()
|
||
Accessible.name: "Play or pause"
|
||
}
|
||
DashButton {
|
||
anchors.verticalCenter: parent.verticalCenter
|
||
glyph: ""
|
||
fallback: "›"
|
||
interactive: !!MediaService.player && MediaService.player.canGoNext
|
||
onClicked: MediaService.next()
|
||
Accessible.name: "Next track"
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
component ResourceBar: Column {
|
||
id: bar
|
||
property var value: null
|
||
property string glyph
|
||
property string fallback
|
||
property string label
|
||
spacing: 8
|
||
readonly property real target: Number.isFinite(value) ? Math.max(0, Math.min(100, value)) : 0
|
||
// Only visible jumps animate (see Gauge).
|
||
property real shown
|
||
property bool easeJump: false
|
||
Component.onCompleted: shown = target
|
||
onTargetChanged: {
|
||
easeJump = Math.abs(target - shown) >= 2;
|
||
shown = target;
|
||
}
|
||
Text {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
text: Number.isFinite(bar.value) ? Math.round(bar.value) + "%" : "—"
|
||
color: Theme.text
|
||
font.pixelSize: 11
|
||
font.features: {
|
||
"tnum": 1
|
||
}
|
||
}
|
||
Rectangle {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
width: 10
|
||
height: 196
|
||
radius: 5
|
||
color: Qt.alpha(Theme.text, 0.1)
|
||
Rectangle {
|
||
anchors.bottom: parent.bottom
|
||
width: parent.width
|
||
height: Math.max(parent.width, parent.height * bar.shown / 100)
|
||
radius: 5
|
||
color: bar.shown > 85 ? Theme.urgent : Theme.accentVivid
|
||
Behavior on height {
|
||
enabled: bar.easeJump
|
||
NumberAnimation {
|
||
duration: Theme.duration * 2
|
||
easing.type: Easing.OutCubic
|
||
}
|
||
}
|
||
}
|
||
}
|
||
Text {
|
||
anchors.horizontalCenter: parent.horizontalCenter
|
||
text: Icons.available ? bar.glyph : bar.fallback
|
||
font.family: Icons.available ? Icons.family : ""
|
||
font.pixelSize: 15
|
||
color: Theme.textSecondary
|
||
Accessible.name: bar.label
|
||
}
|
||
}
|
||
}
|