Files
glassMxrph/quickshell/components/DrawerShape.qml
T
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

61 lines
2.5 KiB
QML

import QtQuick
import QtQuick.Shapes
import "../theme"
// Drawer body hanging from the bar: concave "ears" blend it into the bar's
// bottom edge and its top side has no border, so bar and drawer read as one
// shape. `bodyHeight` is the revealed height; detached drawers are plain cards.
Item {
id: root
property real bodyWidth: 300
property real bodyHeight: 200
property real ear: 16
property real radius: Theme.radius
property bool attached: true
property color fillColor: Qt.alpha(Theme.surface, Theme.glassOpacity)
property color borderColor: Theme.border
implicitWidth: bodyWidth + (attached ? 2 * ear : 0)
implicitHeight: bodyHeight
readonly property real w: implicitWidth
readonly property real h: Math.max(0, bodyHeight)
// Ears and corners shrink while the drawer is still short.
readonly property real e: Math.min(ear, h)
readonly property real r: Math.max(0, Math.min(radius, h - e, bodyWidth / 2))
readonly property string body: {
const W = w, E = ear, h = root.h, e = root.e, r = root.r;
return `L ${W - E} ${h - r} A ${r} ${r} 0 0 1 ${W - E - r} ${h} L ${E + r} ${h} A ${r} ${r} 0 0 1 ${E} ${h - r} L ${E} ${e}`;
}
visible: h > 0.5
Shape {
anchors.fill: parent
visible: root.attached
preferredRendererType: Shape.CurveRenderer
ShapePath {
fillColor: root.fillColor
strokeColor: "transparent"
strokeWidth: 0
PathSvg {
path: `M 0 0 L ${root.w} 0 A ${root.ear} ${root.e} 0 0 0 ${root.w - root.ear} ${root.e} ${root.body} A ${root.ear} ${root.e} 0 0 0 0 0 Z`
}
}
// Outline everywhere except along the bar.
ShapePath {
fillColor: "transparent"
strokeColor: root.borderColor
strokeWidth: 1
PathSvg {
path: `M 0 0.5 A ${root.ear} ${root.e} 0 0 1 ${root.ear} ${root.e} L ${root.ear} ${root.h - root.r} A ${root.r} ${root.r} 0 0 0 ${root.ear + root.r} ${root.h - 0.5} L ${root.w - root.ear - root.r} ${root.h - 0.5} A ${root.r} ${root.r} 0 0 0 ${root.w - root.ear} ${root.h - root.r} L ${root.w - root.ear} ${root.e} A ${root.ear} ${root.e} 0 0 1 ${root.w} 0.5`
}
}
}
Rectangle {
anchors.fill: parent
visible: !root.attached
radius: Math.min(root.radius, root.h / 2)
color: root.fillColor
border.width: 1
border.color: root.borderColor
}
}