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>
58 lines
1.7 KiB
QML
58 lines
1.7 KiB
QML
import QtQuick
|
|
import qs.compat.omarchy.Commons
|
|
Item {
|
|
id: root
|
|
|
|
property string text: ""
|
|
property string fontFamily: Style.font.family
|
|
property real fontSize: Style.font.body
|
|
property color color: Color.foreground
|
|
property bool debugBounds: false
|
|
|
|
readonly property int renderedFontSize: Math.max(1, Math.round(fontSize))
|
|
readonly property real tightWidth: Math.max(1, glyphMetrics.tightBoundingRect.width)
|
|
readonly property real horizontalCorrection: glyph.implicitWidth / 2 - (glyphMetrics.tightBoundingRect.x + tightWidth / 2)
|
|
readonly property real paintedCenterX: glyph.x + glyphMetrics.tightBoundingRect.x + tightWidth / 2
|
|
readonly property real baselineY: glyph.y + glyph.baselineOffset
|
|
|
|
TextMetrics {
|
|
id: glyphMetrics
|
|
font.family: root.fontFamily
|
|
font.pixelSize: root.renderedFontSize
|
|
text: root.text
|
|
}
|
|
|
|
Text {
|
|
id: glyph
|
|
textFormat: Text.PlainText
|
|
// Keep the shared line box and baseline intact. Correcting only the
|
|
// horizontal painted bounds avoids per-glyph vertical drift.
|
|
// The correction is fractional, so x is set exactly: centerIn would snap it
|
|
// to a whole pixel and undo it. y still snaps, keeping the baseline crisp.
|
|
x: (root.width - width) / 2 + root.horizontalCorrection
|
|
y: Math.round((root.height - height) / 2)
|
|
text: root.text
|
|
color: root.color
|
|
font.family: root.fontFamily
|
|
font.pixelSize: root.renderedFontSize
|
|
renderType: Text.NativeRendering
|
|
}
|
|
|
|
Rectangle {
|
|
visible: root.debugBounds
|
|
anchors.fill: parent
|
|
color: "transparent"
|
|
border.width: 1
|
|
border.color: "#4488ff"
|
|
}
|
|
|
|
Rectangle {
|
|
visible: root.debugBounds
|
|
x: 0
|
|
y: Math.round(root.baselineY)
|
|
width: parent.width
|
|
height: 1
|
|
color: "#44ff88"
|
|
}
|
|
}
|