Files
glassMxrph/quickshell/bar/Bar.qml
T
mxandClaude Opus 5.5 1d54aed0b8 Reserve bar space, draw wallpaper natively by default, decode WebP
- The bar now reserves its margin and height as an exclusive zone, so
  windows tile below it instead of underneath. The overhang below the
  bar, where drawers attach, stays unreserved.
- The "auto" wallpaper backend falls back to glassMxrph's native
  background when no external provider (serpantinum, awww) is running,
  instead of reporting none. The background surface follows the
  resolved backend.
- The package adds Qt's extra image-format plugins (qtimageformats) to
  QT_PLUGIN_PATH, so WebP wallpapers (including WebP files with a .jpg
  name) decode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 23:16:33 +02:00

67 lines
3.0 KiB
QML

import QtQuick
import QtQuick.Shapes
import Quickshell
import Quickshell.Wayland
import "../components"
import "../core"
import "../services"
import "../theme"
// Quickshell selects the concrete PanelWindow implementation at runtime.
// qmllint disable uncreatable-type
PanelWindow {
// qmllint enable uncreatable-type
id: root
required property var modelData
screen: modelData
anchors { top: true; left: true; right: true }
readonly property int outerMargin: BarDrawers.margin
// The window reaches below the bar (input is masked to the bar) so the
// HyprGlass layer edge is not on the bar's bottom edge, where drawers join.
implicitHeight: BarDrawers.bottom + BarDrawers.overhang
mask: Region { item: panel }
color: Theme.transparent
// Reserve the bar itself (margin + height), not the overhang below it, so
// windows tile beneath the bar instead of under it.
exclusionMode: ExclusionMode.Normal
exclusiveZone: BarDrawers.bottom
WlrLayershell.namespace: "glassMxrph-bar"
Component.onCompleted: TrayService.registerBar(root)
Component.onDestruction: TrayService.unregisterBar(root)
GlassPanel {
id: panel
x: root.outerMargin; y: root.outerMargin
width: root.width - 2 * root.outerMargin
height: BarDrawers.height
radius: BarDrawers.radius
border.width: 0
ModuleRow { position: "left"; barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter }
ModuleRow { position: "center"; barScreen: root.screen; anchors.centerIn: parent }
ModuleRow { position: "right"; barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter }
}
// Outline with openings where drawers hang from the bar.
Shape {
id: outline
x: panel.x
y: panel.y
width: panel.width
height: panel.height
preferredRendererType: Shape.CurveRenderer
readonly property var gaps: BarDrawers.gapsFor(root.screen ? root.screen.name : "").map(g => [g.x0 - panel.x, g.x1 - panel.x]).sort((a, b) => b[0] - a[0])
ShapePath {
fillColor: "transparent"
strokeColor: Theme.border
strokeWidth: 1
PathSvg {
path: {
const W = panel.width - 1, H = panel.height - 0.5, r = Math.max(0, panel.radius - 0.5), o = 0.5;
let d = `M ${r + o} ${o} L ${W - r} ${o} A ${r} ${r} 0 0 1 ${W} ${r + o} L ${W} ${H - r} A ${r} ${r} 0 0 1 ${W - r} ${H}`;
// Bottom edge right to left, skipping each drawer's span.
for (const g of outline.gaps)
d += ` L ${Math.min(W - r, Math.max(r, g[1]))} ${H} M ${Math.max(r, Math.min(W - r, g[0]))} ${H}`;
return d + ` L ${r + o} ${H} A ${r} ${r} 0 0 1 ${o} ${H - r} L ${o} ${r + o} A ${r} ${r} 0 0 1 ${r + o} ${o}`;
}
}
}
}
}