Files
glassMxrph/quickshell/core/BarDrawers.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

57 lines
2.2 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import "../services"
import "../theme"
// Caelestia-style drawers: popups that grow out of the bar's bottom edge as one
// continuous shape. Drawers register the span they occupy so the bar can open
// its border there; geometry helpers keep every drawer on the bar's straight edge.
Singleton {
id: root
readonly property int margin: ConfigService.ready ? ConfigService.data.bar.margin : 10
readonly property int height: ConfigService.ready ? ConfigService.data.bar.height : 48
// Screen y of the bar's bottom edge, where drawers attach.
readonly property int bottom: margin + height
readonly property real radius: Math.min(Theme.radius, height / 2)
// Concave fillet joining a drawer to the bar.
readonly property real ear: Math.max(8, Math.min(18, Theme.radius * 0.8))
// The bar window reaches this far below the bar so its glass edge never
// lands on the join (HyprGlass refracts at layer box edges).
readonly property int overhang: 28
// screen name -> [{id, x0, x1}] in screen coordinates.
property var gaps: ({})
function setGap(id, screenName, x0, x1) {
const next = Object.assign({}, gaps);
for (const key in next)
next[key] = next[key].filter(g => g.id !== id);
if (screenName)
next[screenName] = (next[screenName] || []).concat([
{
id: id,
x0: x0,
x1: x1
}
]);
gaps = next;
}
function clearGap(id) {
setGap(id, "", 0, 0);
}
function gapsFor(screenName) {
return gaps[screenName] || [];
}
// Left edge (screen x) for a drawer of `outerWidth` (body plus both ears)
// centred on `centerX`, kept within the bar's straight bottom edge.
function clampX(centerX, outerWidth, screenWidth) {
const lo = margin + radius, hi = screenWidth - margin - radius - outerWidth;
return Math.round(Math.max(lo, Math.min(centerX - outerWidth / 2, hi)));
}
function leftX() {
return Math.round(margin + radius);
}
function rightX(outerWidth, screenWidth) {
return Math.round(screenWidth - margin - radius - outerWidth);
}
}