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>
This commit is contained in:
commit
99e64a7713
433 files changed
+57792
No files matched your search
@@ -0,0 +1,172 @@
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import Quickshell.Wayland
|
||||
import qs.compat.omarchy.Commons
|
||||
import "../../../components" as C
|
||||
import "../../../core" as Core
|
||||
import "../../../theme" as G
|
||||
|
||||
// glassMxrph base for Omarchy's PopupCard and KeyboardPanel: the popup is a
|
||||
// glassMxrph bar drawer that grows out of the bar under its anchor, with the
|
||||
// same glass, ears and animation as the shell's own panels. The public API
|
||||
// (sizes, fitted*/capped* helpers, open/close, owner, focusTarget, popout
|
||||
// coordination) matches Omarchy so plugins work unchanged.
|
||||
//
|
||||
// mode: "keyboard" — exclusive keyboard focus, outside clicks close (like the
|
||||
// Control Center); "click" — focus grab, outside clicks
|
||||
// close; "hover" — passive, the owner opens/closes it.
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
required property Item anchorItem
|
||||
required property QtObject bar
|
||||
property var owner: null
|
||||
property string mode: "keyboard"
|
||||
property int margin: 8
|
||||
property int padding: Style.spacing.popupPadding
|
||||
property int contentWidth: Style.space(280)
|
||||
property int contentHeight: Style.space(200)
|
||||
property var borderSpec: Border.none()
|
||||
property color borderColor: G.Theme.border
|
||||
property bool centerOnBar: false
|
||||
property bool open: false
|
||||
property int gap: 0
|
||||
property bool popoutSwitching: false
|
||||
property bool popoutSwitchClosing: false
|
||||
property bool focusPrimed: true
|
||||
property Item focusTarget: null
|
||||
|
||||
default property alias contentItem: contentHolder.children
|
||||
|
||||
readonly property var coordinatorKey: owner || root
|
||||
readonly property var anchorWindow: anchorItem ? anchorItem.QsWindow.window : null
|
||||
readonly property string barPos: "top"
|
||||
readonly property bool containsMouse: drawer.hovered
|
||||
|
||||
function close() {
|
||||
if (owner && "close" in owner) owner.close()
|
||||
else root.open = false
|
||||
}
|
||||
function beginFocusPrime() {
|
||||
}
|
||||
|
||||
screen: anchorWindow ? anchorWindow.screen : null
|
||||
readonly property real screenW: screen ? screen.width : 0
|
||||
readonly property real screenH: screen ? screen.height : 0
|
||||
readonly property real sideSpace: 2 * (Core.BarDrawers.margin + Core.BarDrawers.radius + Core.BarDrawers.ear)
|
||||
readonly property real availableCardWidth: screenW > 0 ? Math.max(120, screenW - sideSpace) : 0
|
||||
readonly property real availableCardHeight: screenH > 0 ? Math.max(120, screenH - Core.BarDrawers.bottom - 20) : 0
|
||||
readonly property real verticalContentInset: padding * 2
|
||||
|
||||
function fittedContentWidth(width, cap) {
|
||||
var desired = Math.max(1, Number(width) || 1)
|
||||
var maxWidth = root.availableCardWidth > 0 ? root.availableCardWidth : desired
|
||||
if (cap !== undefined && Number(cap) > 0) maxWidth = Math.min(maxWidth, Number(cap))
|
||||
return Math.round(Math.min(desired, maxWidth))
|
||||
}
|
||||
function fittedContentHeight(implicitHeight, cap) {
|
||||
var desired = Math.max(root.verticalContentInset, (Number(implicitHeight) || 0) + root.verticalContentInset)
|
||||
var maxHeight = root.availableCardHeight > 0 ? root.availableCardHeight : desired
|
||||
if (cap !== undefined && Number(cap) > 0) maxHeight = Math.min(maxHeight, Number(cap))
|
||||
return Math.round(Math.min(desired, maxHeight))
|
||||
}
|
||||
function cappedContentHeight(height) {
|
||||
var desired = Math.max(root.padding * 2, Number(height) || root.padding * 2)
|
||||
var maxHeight = root.availableCardHeight > 0 ? root.availableCardHeight : desired
|
||||
return Math.round(Math.min(desired, maxHeight))
|
||||
}
|
||||
|
||||
readonly property real barW: anchorWindow ? anchorWindow.width : screenW
|
||||
readonly property real barH: Core.BarDrawers.bottom
|
||||
// Re-read on open: mapToItem is not reactive to layout changes.
|
||||
readonly property point anchorScreenPos: {
|
||||
root.open
|
||||
if (!anchorItem || !anchorWindow) return Qt.point(0, 0)
|
||||
return anchorItem.mapToItem(anchorWindow.contentItem, 0, 0)
|
||||
}
|
||||
readonly property real anchorW: anchorItem ? anchorItem.width : 0
|
||||
readonly property real anchorH: anchorItem ? anchorItem.height : 0
|
||||
readonly property real outerWidth: drawer.width
|
||||
readonly property real drawerX: centerOnBar
|
||||
? Math.round((screenW - outerWidth) / 2)
|
||||
: Core.BarDrawers.clampX(anchorScreenPos.x + anchorW / 2, outerWidth, screenW)
|
||||
readonly property point cardOrigin: Qt.point(drawerX + drawer.ear, Core.BarDrawers.bottom)
|
||||
|
||||
// Hang from the bar: the layer starts at the screen top so the join with
|
||||
// the bar is inside its box (no HyprGlass edge there).
|
||||
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 || popoutSwitching
|
||||
color: "transparent"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
WlrLayershell.namespace: "glassMxrph-plugin-popup"
|
||||
WlrLayershell.layer: WlrLayer.Overlay
|
||||
WlrLayershell.keyboardFocus: !open ? WlrKeyboardFocus.None : mode === "keyboard" ? WlrKeyboardFocus.Exclusive : mode === "click" ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||
// Passive popups only take input on the drawer itself.
|
||||
Region {
|
||||
id: bodyMask
|
||||
item: drawer.body
|
||||
}
|
||||
mask: mode === "keyboard" ? null : bodyMask
|
||||
|
||||
onOpenChanged: {
|
||||
if (open && focusTarget) Qt.callLater(function() {
|
||||
if (root.open && root.focusTarget) root.focusTarget.forceActiveFocus()
|
||||
})
|
||||
if (!bar) return
|
||||
if (open) {
|
||||
popoutSwitchClosing = false
|
||||
if (bar.requestPopout) bar.requestPopout(coordinatorKey)
|
||||
} else {
|
||||
popoutSwitchClosing = !!(owner && owner.popoutSwitchClosing)
|
||||
if (bar.activePopout === coordinatorKey && bar.releasePopout) bar.releasePopout(coordinatorKey)
|
||||
}
|
||||
}
|
||||
|
||||
// Keyboard mode: Hyprland routes every click to the exclusive layer, so
|
||||
// outside clicks arrive here with out-of-bounds coordinates (see ControlCenter).
|
||||
MouseArea {
|
||||
x: -20000
|
||||
y: -20000
|
||||
width: 40000
|
||||
height: 40000
|
||||
enabled: root.open && root.mode === "keyboard"
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onPressed: root.close()
|
||||
}
|
||||
HyprlandFocusGrab {
|
||||
active: root.open && root.mode === "click"
|
||||
windows: root.anchorWindow ? [root, root.anchorWindow] : [root]
|
||||
onCleared: root.close()
|
||||
}
|
||||
|
||||
C.BarDrawer {
|
||||
id: drawer
|
||||
y: Core.BarDrawers.bottom
|
||||
open: root.open
|
||||
contentWidth: root.contentWidth
|
||||
contentHeight: root.contentHeight
|
||||
drawerId: "plugin-popup-" + (root.owner && root.owner.moduleName ? root.owner.moduleName : "")
|
||||
screenName: root.screen ? root.screen.name : ""
|
||||
screenX: root.drawerX
|
||||
|
||||
// Swallow clicks on the card so they never reach the outside catcher.
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.AllButtons
|
||||
}
|
||||
Item {
|
||||
id: contentHolder
|
||||
anchors.fill: parent
|
||||
anchors.margins: root.padding
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user