Files
mxandClaude Opus 5.5 99e64a7713 Add glassMxrph shell sources
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>
2026-10-07 22:36:17 +02:00

126 lines
4.7 KiB
QML

import QtQuick
import QtQuick.Effects
import Quickshell
import "../../services"
import "../../theme"
Face {
id: root
readonly property bool seconds: !!options.seconds
SystemClock {
id: clock
precision: root.seconds || root.variant === "analog" ? SystemClock.Seconds : SystemClock.Minutes
}
// Follows the bar clock's 12/24-hour preference.
readonly property string timeFormat: (ConfigService.ready && !ConfigService.data.bar.clock.use24Hour ? "h:mm" : "HH:mm") + (seconds ? ":ss" : "")
// Digital: large time with the date below.
Column {
visible: root.variant === "digital"
anchors.centerIn: parent
spacing: root.height * 0.02
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Qt.formatTime(clock.date, root.timeFormat)
color: Theme.text
font.pixelSize: Math.min(root.height * 0.42, root.width / (root.seconds ? 4.4 : 3))
font.weight: Font.Light
font.features: {
"tnum": 1
}
}
Text {
anchors.horizontalCenter: parent.horizontalCenter
text: Qt.formatDate(clock.date, "dddd, d MMMM")
color: Theme.textSecondary
font.pixelSize: Math.max(10, root.height * 0.11)
}
}
// Minimal: no card; large thin time and the weekday, readable on any wallpaper.
Item {
id: minimal
visible: root.variant === "minimal"
anchors.fill: parent
layer.enabled: visible
layer.effect: MultiEffect {
shadowEnabled: true
shadowColor: "#99000000"
shadowBlur: 0.6
shadowVerticalOffset: 2
}
Column {
anchors.left: parent.left
anchors.leftMargin: root.width * 0.04
anchors.verticalCenter: parent.verticalCenter
Text {
text: Qt.formatTime(clock.date, root.timeFormat)
color: Theme.text
font.pixelSize: Math.min(root.height * 0.55, root.width / (root.seconds ? 4.2 : 2.9))
font.weight: Font.Thin
font.features: {
"tnum": 1
}
}
Text {
text: Qt.formatDate(clock.date, "dddd d MMMM").toUpperCase()
color: Theme.text
opacity: 0.85
font.pixelSize: Math.max(10, root.height * 0.1)
font.letterSpacing: 2
font.weight: Font.DemiBold
}
}
}
// Analog: ticks and hands; the second hand follows the seconds option.
Canvas {
id: dial
visible: root.variant === "analog"
anchors.centerIn: parent
width: Math.min(root.width, root.height) - 16
height: width
readonly property var time: clock.date
readonly property color hand: Theme.text
readonly property color accent: Theme.accentVivid
onTimeChanged: requestPaint()
onVisibleChanged: if (visible)
requestPaint()
onWidthChanged: requestPaint()
onPaint: {
const ctx = getContext("2d");
ctx.reset();
const r = width / 2;
ctx.translate(r, r);
for (let i = 0; i < 60; i++) {
const a = i * Math.PI / 30, major = i % 5 === 0;
ctx.beginPath();
ctx.moveTo(Math.sin(a) * r * (major ? 0.82 : 0.9), -Math.cos(a) * r * (major ? 0.82 : 0.9));
ctx.lineTo(Math.sin(a) * r * 0.96, -Math.cos(a) * r * 0.96);
ctx.strokeStyle = Qt.alpha(hand, major ? 0.85 : 0.3);
ctx.lineWidth = major ? Math.max(1.5, r * 0.035) : 1;
ctx.lineCap = "round";
ctx.stroke();
}
const d = time, h = d.getHours() % 12, m = d.getMinutes(), s = d.getSeconds();
const handAt = (angle, length, widthFactor, color) => {
ctx.beginPath();
ctx.moveTo(-Math.sin(angle) * r * 0.1, Math.cos(angle) * r * 0.1);
ctx.lineTo(Math.sin(angle) * r * length, -Math.cos(angle) * r * length);
ctx.strokeStyle = color;
ctx.lineWidth = Math.max(1.5, r * widthFactor);
ctx.lineCap = "round";
ctx.stroke();
};
handAt((h + m / 60) * Math.PI / 6, 0.5, 0.06, hand);
handAt((m + s / 60) * Math.PI / 30, 0.74, 0.04, hand);
if (root.seconds)
handAt(s * Math.PI / 30, 0.8, 0.015, accent);
ctx.beginPath();
ctx.arc(0, 0, Math.max(3, r * 0.05), 0, 2 * Math.PI);
ctx.fillStyle = accent;
ctx.fill();
}
}
}