Files
glassMxrph/quickshell/compat/noctalia/Host/PanelHost.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

104 lines
3.6 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
import "../../../components" as C
import "../../../core" as Core
import "../../../services" as GS
// Hosts a Noctalia v4 plugin's Panel.qml as a glassMxrph bar drawer: it grows
// out of the bar under the button that opened it, sized from the panel's
// contentPreferredWidth/Height. Escape or an outside click closes it.
PanelWindow {
id: root
required property var api
property url source: ""
readonly property bool open: !!api && !!api.panelOpenScreen
// Lets test drivers find this panel.
Component.onCompleted: GS.PluginService.panelWindows[api.pluginId] = root
// Keep the last screen while the drawer animates closed.
property var lastScreen: null
onOpenChanged: {
if (open)
lastScreen = api.panelOpenScreen;
else
GS.PluginService.releasePopout(api);
}
screen: open ? api.panelOpenScreen : lastScreen
readonly property Item anchorItem: api && api.panelAnchor ? api.panelAnchor : null
readonly property var anchorWindow: anchorItem && anchorItem.QsWindow ? anchorItem.QsWindow.window : null
readonly property bool fromBar: !!anchorWindow && GS.TrayService.barWindows.includes(anchorWindow)
readonly property real screenW: screen ? screen.width : 1920
readonly property real screenH: screen ? screen.height : 1080
readonly property real anchorCenter: {
root.open;
if (!fromBar)
return screenW / 2;
const p = anchorItem.mapToItem(anchorWindow.contentItem, anchorItem.width / 2, 0);
return p.x;
}
readonly property Item panel: loader.item
readonly property var panelObject: loader.item
readonly property real preferredWidth: panelObject && panelObject.contentPreferredWidth > 0 ? panelObject.contentPreferredWidth : 400
readonly property real preferredHeight: panelObject && panelObject.contentPreferredHeight > 0 ? panelObject.contentPreferredHeight : 320
readonly property real drawerX: Core.BarDrawers.clampX(anchorCenter, drawer.width, screenW)
anchors {
top: true
left: true
}
// qmllint disable unqualified unresolved-type
margins.left: root.drawerX
// qmllint enable unqualified unresolved-type
implicitWidth: Math.max(1, Math.round(drawer.width))
implicitHeight: Math.max(1, Math.round(Core.BarDrawers.bottom + drawer.contentHeight))
visible: open || drawer.shown
color: "transparent"
exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "glassMxrph-plugin-panel"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: open ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None
MouseArea {
x: -20000
y: -20000
width: 40000
height: 40000
enabled: root.open
onPressed: root.api.closePanel(null)
}
C.BarDrawer {
id: drawer
objectName: "noctaliaPanelSurface"
y: Core.BarDrawers.bottom
open: root.open
contentWidth: Math.min(root.preferredWidth, root.screenW - 2 * (Core.BarDrawers.margin + Core.BarDrawers.radius + ear))
contentHeight: Math.min(root.preferredHeight, root.screenH - Core.BarDrawers.bottom - 20)
drawerId: "noctalia-panel-" + (root.api ? root.api.pluginId : "")
screenName: root.screen ? root.screen.name : ""
screenX: root.drawerX
focus: root.open
Keys.onEscapePressed: root.api.closePanel(null)
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.AllButtons
}
Loader {
id: loader
anchors.fill: parent
active: root.open || drawer.shown
onActiveChanged: if (active)
setSource(root.source, {
pluginApi: root.api
})
onLoaded: {
if ("screen" in item)
item.screen = Qt.binding(() => root.screen);
}
}
}
}