Files
glassMxrph/quickshell/bar/Bar.qml
T
mxandClaude Opus 5.5 52a0e29959 Grow the launcher out of the notch like the notch panel
In notch mode the launcher now morphs from the collapsed notch with the
notch's own curve and open/close speeds: the shape stays solid, width
leads the height, and the search fades in once it is mostly open. The
notch's time and media fade out as it grows and back in as it closes,
and the pill stays hidden until the launcher has shrunk home. The pill's
contents move to NotchGlance so both can draw them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 14:46:39 +01:00

118 lines
5.9 KiB
QML

import QtQuick
import QtQuick.Shapes
import Quickshell
import Quickshell.Wayland
import "../components"
import "../notch"
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
// Notch mode splits the bar into a left island, the centre notch and a
// right island; only those take input.
readonly property bool notch: ShellState.notchMode
mask: Region {
item: root.notch ? leftIsland : panel
Region { item: root.notch ? notchPill : null; intersection: Intersection.Combine }
Region { item: root.notch ? rightIsland : null; intersection: Intersection.Combine }
}
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
visible: !root.notch
x: root.outerMargin; y: root.outerMargin
width: root.width - 2 * root.outerMargin
height: BarDrawers.height
radius: BarDrawers.radius
border.width: 0
// In notch mode the side rows move into their islands; the notch replaces the centre.
// Notch mode unloads these; its islands carry their own module lists.
ModuleRow { position: "left"; active: !root.notch; barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter }
ModuleRow { position: "center"; active: !root.notch; barScreen: root.screen; anchors.centerIn: parent }
ModuleRow { position: "right"; active: !root.notch; 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
visible: !root.notch
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}`;
}
}
}
}
// Notch mode -------------------------------------------------------------
GlassPanel {
id: leftIsland
// No bar behind the modules in notch mode: they float on their own.
color: Theme.transparent
border.width: 0
plain: true
visible: root.notch && ConfigService.ready && ConfigService.data.notch.left.length > 0
x: root.outerMargin
y: root.outerMargin
width: leftRow.implicitWidth + 12
height: BarDrawers.height
radius: BarDrawers.radius
ModuleRow { id: leftRow; position: "left"; active: root.notch; modules: BarLayout.notchModules(root.screen ? root.screen.name : "", "left"); barScreen: root.screen; anchors.left: parent.left; anchors.leftMargin: 6; anchors.verticalCenter: parent.verticalCenter }
}
GlassPanel {
id: rightIsland
// No bar behind the modules in notch mode: they float on their own.
color: Theme.transparent
border.width: 0
plain: true
visible: root.notch && ConfigService.ready && ConfigService.data.notch.right.length > 0
x: root.width - root.outerMargin - width
y: root.outerMargin
width: rightRow.implicitWidth + 12
height: BarDrawers.height
radius: BarDrawers.radius
ModuleRow { id: rightRow; position: "right"; active: root.notch; modules: BarLayout.notchModules(root.screen ? root.screen.name : "", "right"); barScreen: root.screen; anchors.right: parent.right; anchors.rightMargin: 6; anchors.verticalCenter: parent.verticalCenter }
}
NotchPill {
id: notchPill
barScreen: root.screen
x: Math.round((root.width - width) / 2)
y: 0
width: implicitWidth
height: implicitHeight
// The open notch window draws over this spot on its own screen.
visible: root.notch && !(ShellState.notchWindow && ShellState.notchWindow.visible && ShellState.notchWindow.screen === root.screen) && !(ShellState.launcherWindow && ShellState.launcherWindow.visible && ShellState.launcherWindow.screen === root.screen) && !(ShellState.wallpaperWindow && ShellState.wallpaperWindow.visible && ShellState.wallpaperWindow.screen === root.screen)
}
}