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:
mxandClaude Opus 5.5 committed 2026-10-07 22:36:17 +02:00
commit 99e64a7713
433 files changed
+57792

No files matched your search

+85
View File
@@ -0,0 +1,85 @@
import QtQuick
import Quickshell
import Quickshell.Services.SystemTray
import "../core"
import "../services"
import "../theme"
Item {
id: root
objectName: "trayIcon"
required property var trayItem
readonly property var containingWindow: root.QsWindow.window
property var barScreen
// Tray pill this icon sits in. Menus and tooltips are placed under it so
// they do not jump sideways while moving between icons.
property var group: null
readonly property Item placement: group || root
readonly property bool pointerInside: mouse.containsMouse || (!!group && group.hovered)
readonly property bool menuActive: TrayService.opened && TrayService.anchorItem === root
width: TrayService.options.iconSize + 12; height: ModuleRegistry.pillHeight
Component.onCompleted: TrayService.registerIcon(root)
Component.onDestruction: TrayService.unregisterIcon(root)
readonly property string label: trayItem ? (trayItem.tooltipTitle || trayItem.title || trayItem.id) : ""
readonly property bool hoverMenu: TrayService.options.hoverMenus && !!trayItem && trayItem.hasMenu
// Once a menu or bar popout is open, hovering another icon switches instantly
// (keeping a click-opened menu sticky); otherwise wait for the hover delay.
function enter() {
if (menuActive) return;
if (!hoverMenu) { PopoutState.hover(root, label ? "tooltip" : "", label); return; }
if (PopoutState.warm) openMenu(TrayService.opened ? TrayService.closeOnLeave : true);
else intent.restart();
}
function leave() { intent.stop(); PopoutState.unhover(root); }
function openMenu(hover) {
intent.stop();
return TrayService.open(trayItem, root, hover);
}
function click(button, modifiers) {
intent.stop();
PopoutState.close();
if (!trayItem) return;
if (button === Qt.RightButton || (button === Qt.LeftButton && trayItem.onlyMenu)) {
if ((modifiers & Qt.ShiftModifier) || !trayItem.hasMenu) {
TrayService.close();
const window = root.containingWindow;
const point = root.mapToItem(window.contentItem, 0, root.height);
trayItem.display(window, point.x, point.y);
} else openMenu(false);
} else {
TrayService.close();
if (button === Qt.MiddleButton) trayItem.secondaryActivate(); else trayItem.activate();
}
}
Rectangle {
anchors.fill: parent; radius: height / 2
color: root.menuActive ? Qt.alpha(Theme.accent, 0.2) : root.pointerInside ? Qt.alpha(Theme.text, 0.12) : TrayService.options.background === "icons" ? Theme.surfaceVariant : Theme.transparent
border.width: root.menuActive ? 1 : 0; border.color: Theme.border
Behavior on color { ColorAnimation { duration: Theme.duration } }
}
Image {
anchors.centerIn: parent; width: TrayService.options.iconSize; height: width
source: root.trayItem ? root.trayItem.icon : ""
sourceSize.width: width; sourceSize.height: height
fillMode: Image.PreserveAspectFit
scale: mouse.pressed ? 0.92 : 1
Behavior on scale { NumberAnimation { duration: Theme.duration / 2 } }
}
Rectangle {
anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter
width: 4; height: 4; radius: 2; color: Theme.urgent
visible: root.trayItem && root.trayItem.status === Status.NeedsAttention
}
MouseArea {
id: mouse; anchors.fill: parent; hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
cursorShape: Qt.PointingHandCursor
onEntered: root.enter()
onExited: root.leave()
// Moving over an icon also starts the hover, in case no enter event
// arrived (e.g. the pointer was already there when a menu closed).
onPositionChanged: if (!root.menuActive && !intent.running && !TrayService.opened && root.hoverMenu) intent.restart()
onClicked: event => root.click(event.button, event.modifiers)
onWheel: event => { if (root.trayItem) root.trayItem.scroll(event.angleDelta.y || event.angleDelta.x, event.angleDelta.y === 0); }
}
Timer { id: intent; interval: TrayService.options.hoverDelay; onTriggered: if (mouse.containsMouse && TrayService.options.hoverMenus) root.openMenu(true) }
}
+183
View File
@@ -0,0 +1,183 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import Quickshell
import Quickshell.Wayland
import "../components"
import "../core"
import "../services"
import "../theme"
// A layer surface is required for HyprGlass; xdg popups bypass its layer renderer.
// qmllint disable uncreatable-type
PanelWindow {
// qmllint enable uncreatable-type
id: root
property var menuHandle: null
property Item anchorItem: null
property bool isRoot: true
property bool opened: false
property int depth: 0
property var parentMenu: null
property int selectedIndex: -1
property var childEntry: null
property Item childAnchor: null
property bool contentOpen: false
readonly property var entries: opener.children.values
readonly property var anchorWindow: anchorItem ? anchorItem.QsWindow.window : null
screen: anchorWindow ? anchorWindow.screen : null
anchors { top: true; left: true }
exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "glassMxrph-tray"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
readonly property point anchorPoint: anchorItem && anchorWindow
? anchorItem.mapToItem(anchorWindow.contentItem, 0, 0) : Qt.point(0, 0)
// Root menus centre under the icon's placement item (the whole tray pill).
readonly property var anchorObject: anchorItem
readonly property Item placementItem: anchorObject ? (anchorObject.placement || anchorObject) : null
readonly property real placementCenter: placementItem && anchorWindow
? placementItem.mapToItem(anchorWindow.contentItem, placementItem.width / 2, 0).x : 0
readonly property real availableWidth: screen ? screen.width : 1280
readonly property real availableHeight: screen ? screen.height : 720
readonly property real desiredX: {
if (!parentMenu) return placementCenter - implicitWidth / 2;
// A drawer parent's ears are not part of its body.
const inset = parentMenu.isRoot ? BarDrawers.ear : 0;
const right = parentMenu.margins.left + parentMenu.width - inset - 4;
return right + implicitWidth <= availableWidth - 4
? right : parentMenu.margins.left + inset - implicitWidth + 4;
}
// Quickshell 0.3.1 qmllint cannot resolve the exported Margins value type.
// qmllint disable unqualified unresolved-type
margins.left: Math.round(animX)
// The root menu is a drawer hanging from the bar; its layer starts at the screen top.
margins.top: isRoot ? 0 : Math.round(Math.max(4, Math.min(
parentMenu ? parentMenu.margins.top + anchorPoint.y
: anchorPoint.y + (anchorItem ? anchorItem.height : 0),
availableHeight - implicitHeight - 4)))
// qmllint enable unqualified unresolved-type
color: Theme.transparent
readonly property int menuWidth: 280
implicitWidth: isRoot ? menuWidth + 2 * BarDrawers.ear : menuWidth + 8
// Switching icons while open glides the menu over instead of reopening it;
// the previous height is held while the next DBus menu is still loading.
readonly property bool morph: isRoot && contentOpen && drawerSurface.progress > 0.05 && Theme.duration > 0
readonly property real targetX: isRoot ? BarDrawers.clampX(desiredX + implicitWidth / 2, implicitWidth, availableWidth) : Math.max(4, Math.min(desiredX, availableWidth - implicitWidth - 4))
readonly property real contentTarget: Math.min((screen ? screen.height : 720) - 80 - (isRoot ? BarDrawers.bottom : 0), Math.max(50, list.contentHeight + 16))
property real heldHeight: 58
readonly property real targetHeight: entries.length === 0 && emptyTimer.running && morph ? heldHeight : contentTarget
onContentTargetChanged: if (entries.length > 0) heldHeight = contentTarget
property real animX: targetX
property real animH: targetHeight
Behavior on animX { enabled: root.morph; NumberAnimation { duration: Theme.duration * 1.2; easing.type: Easing.OutCubic } }
Behavior on animH { enabled: root.morph; NumberAnimation { duration: Theme.duration; easing.type: Easing.OutCubic } }
implicitHeight: Math.round(animH + (isRoot ? BarDrawers.bottom : 8))
Region {
id: drawerMask
item: drawerSurface.body
}
mask: isRoot ? drawerMask : null
onMenuHandleChanged: if (opened && isRoot) { emptyTimer.restart(); swap.restart(); }
visible: opened || surface.visible || drawerSurface.shown
onOpenedChanged: {
if (opened) { selectedIndex = -1; childEntry = null; emptyTimer.restart(); Qt.callLater(() => { contentOpen = true; menuBody.forceActiveFocus(); }); }
else { contentOpen = false; childEntry = null; submenuTimer.stop(); emptyTimer.stop(); }
}
Component.onCompleted: { TrayService.registerWindow(root); if (opened) { contentOpen = true; emptyTimer.restart(); } }
Component.onDestruction: TrayService.unregisterWindow(root)
onEntriesChanged: { childEntry = null; selectedIndex = -1; }
function dismissChild() { childEntry = null; menuBody.forceActiveFocus(); }
function select(index, keyboard) {
selectedIndex = index;
const entry = entries[index];
if (childEntry !== entry) childEntry = null;
submenuTimer.stop();
if (entry && entry.enabled && entry.hasChildren && !keyboard) submenuTimer.restart();
}
function move(direction) {
for (let i = 1; i <= entries.length; ++i) {
const next = (selectedIndex + direction * i + entries.length) % entries.length;
if (entries[next].enabled && !entries[next].isSeparator) { select(next, true); list.positionViewAtIndex(next, ListView.Contain); return; }
}
}
function invoke(index) {
const entry = entries[index];
if (!entry || entry.isSeparator || !entry.enabled) return false;
if (entry.hasChildren) { openChild(index); return true; }
entry.triggered(); TrayService.close(); return true;
}
function openChild(index) {
const entry = entries[index];
if (!entry || !entry.enabled || !entry.hasChildren) return;
list.positionViewAtIndex(index, ListView.Contain);
childAnchor = list.itemAtIndex(index);
if (childAnchor) childEntry = entry;
}
function snapshot() { return {depth:depth, screen:screen ? screen.name : "", entries:entries.map(e => ({text:e.text, enabled:e.enabled, separator:e.isSeparator, buttonType:e.buttonType, checkState:e.checkState, hasChildren:e.hasChildren, icon:e.icon !== ""}))}; }
QsMenuOpener { id: opener; menu: root.opened ? root.menuHandle : null }
Timer { id: submenuTimer; interval: 180; onTriggered: root.openChild(root.selectedIndex) }
Timer { id: emptyTimer; interval: 1500 }
NumberAnimation { id: swap; target: list; property: "opacity"; from: 0.2; to: 1; duration: Theme.duration; easing.type: Easing.OutCubic }
// Submenus float beside their parent as glass cards.
GlassMenu {
id: surface; objectName: root.isRoot ? "" : "trayMenuSurface"
visible: !root.isRoot && (opened || opacity > 0.01)
anchors.fill: parent; anchors.margins: 4
opened: root.contentOpen && !root.isRoot
transformOrigin: Item.TopLeft
}
BarDrawer {
id: drawerSurface; objectName: root.isRoot ? "trayMenuSurface" : ""
visible: root.isRoot
y: BarDrawers.bottom
// Open (and take input) at once: a click-opened menu's focus grab needs
// an input region as soon as the menu maps.
open: root.opened && root.isRoot
contentWidth: root.menuWidth
contentHeight: Math.round(root.animH)
drawerId: root.isRoot ? "tray" : ""
screenName: root.screen ? root.screen.name : ""
screenX: root.animX
onHoveredChanged: if (root.isRoot) TrayService.setHovered(root, hovered)
}
// Shared menu body, placed in whichever surface this menu uses.
Item {
id: menuBody
parent: root.isRoot ? drawerSurface.container : surface.contentItem
anchors.fill: parent
anchors.margins: root.isRoot ? 8 : 0
focus: true
Keys.onEscapePressed: TrayService.close()
Keys.onDownPressed: root.move(1)
Keys.onUpPressed: root.move(-1)
Keys.onReturnPressed: root.invoke(root.selectedIndex)
Keys.onEnterPressed: root.invoke(root.selectedIndex)
Keys.onRightPressed: root.openChild(root.selectedIndex)
Keys.onLeftPressed: if (root.parentMenu) root.parentMenu.dismissChild()
HoverHandler { enabled: !root.isRoot; onHoveredChanged: TrayService.setHovered(root, hovered) }
ListView {
id: list; objectName: "trayMenuList"; anchors.fill: parent; clip: true
model: opener.children; boundsBehavior: Flickable.StopAtBounds
ScrollBar.vertical: ScrollBar {}
onContentYChanged: root.childEntry = null
delegate: TrayMenuItem {
required property var modelData
required property int index
entry: modelData; width: list.width
selected: root.selectedIndex === index
onEntered: root.select(index, false)
onInvoked: root.invoke(index)
}
}
Text { anchors.centerIn: parent; visible: root.entries.length === 0; text: emptyTimer.running ? "Loading application menu…" : "No menu entries"; color: Theme.textSecondary; font.pixelSize: 12 }
}
Loader {
active: root.opened && root.childEntry !== null
source: active ? Qt.resolvedUrl("TraySubMenu.qml") : ""
onLoaded: {
item.menuHandle = Qt.binding(() => root.childEntry);
item.anchorItem = Qt.binding(() => root.childAnchor);
item.parentMenu = root; item.depth = root.depth + 1; item.opened = true;
}
}
}
+13
View File
@@ -0,0 +1,13 @@
import QtQuick
import "../components"
GlassMenuItem {
required property var entry
// DBusMenu labels use ampersands for mnemonics. Keep escaped ampersands.
text: entry ? entry.text.replace(/&&/g, "\u0000").replace(/&/g, "").replace(/\u0000/g, "&") : ""
iconSource: entry ? entry.icon : ""
separator: !entry || entry.isSeparator
actionEnabled: !!entry && entry.enabled
submenu: !!entry && entry.hasChildren
buttonType: entry ? entry.buttonType : 0
checkState: entry ? entry.checkState : Qt.Unchecked
}
+18
View File
@@ -0,0 +1,18 @@
import QtQuick
import Quickshell
import Quickshell.Hyprland
import "../services"
Scope {
TrayMenu {
menuHandle: TrayService.currentItem ? TrayService.currentItem.menu : null
anchorItem: TrayService.anchorItem
opened: TrayService.opened
}
HyprlandFocusGrab {
// Hover-opened menus never take keyboard focus from the focused app, and
// without a grab the bar keeps receiving hover for instant handover.
windows: TrayService.windows
active: TrayService.grabbing
onCleared: TrayService.close()
}
}
+2
View File
@@ -0,0 +1,2 @@
import QtQuick
TrayMenu { isRoot: false }