Files
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

96 lines
3.4 KiB
QML

import QtQuick
import QtTest
import Quickshell
import Quickshell.Io
import "../dock"
import "../services"
Item {
id: root
parent: DockState.menuWindow ? DockState.menuWindow.contentItem : null
function icon(id) {
return DockState.icons.find(i => i.group.id === id);
}
TestCase {
id: input
name: "DockInputDriver"
when: false
}
IpcHandler {
target: "dockTest"
function screens(): string {
return JSON.stringify(Quickshell.screens.map(s => s.name));
}
function click(id: string, button: int): bool {
const i = root.icon(id);
if (!i)
return false;
input.mouseClick(i, i.width / 2, i.height / 2, button);
return true;
}
function rows(): string {
return JSON.stringify(DockState.menuWindow.rows.map(r => ({
id: r.id,
text: r.text,
separator: !!r.separator
})));
}
function row(id: string): bool {
const menu = DockState.menuWindow, index = menu.rows.findIndex(r => r.id === id);
if (index < 0)
return false;
const list = input.findChild(menu.contentItem, "dockMenuList");
list.positionViewAtIndex(index, ListView.Contain);
const item = list.itemAtIndex(index);
if (!item)
return false;
input.mouseClick(item, item.width / 2, item.height / 2);
return true;
}
function drag(from: string, to: string): bool {
const a = root.icon(from), b = root.icon(to);
if (!a || !b)
return false;
const p = a.mapFromItem(b, b.width / 2, b.height / 2);
input.mousePress(a, a.width / 2, a.height / 2, Qt.LeftButton);
input.mouseMove(a, p.x, p.y, 80);
input.mouseRelease(a, p.x, p.y, Qt.LeftButton);
return true;
}
function hover(inside: bool): bool {
const d = DockState.docks[0];
if (!d)
return false;
input.mouseMove(d.contentItem, inside ? d.width / 2 : -10, inside ? d.height - 1 : -10);
return true;
}
function pressEscape(): void {
input.keyClick(Qt.Key_Escape);
}
function snapshot(): string {
return JSON.stringify({
windows: HyprlandService.windows.filter(w => w.appId.startsWith("org.glassMxrph.DockFixture")).map(w => ({
address: w.address,
active: w.active,
appId: w.appId,
monitor: w.monitor,
width: w.width,
height: w.height
})),
icons: DockState.icons.map(i => ({
id: i.group.id,
width: i.width,
height: i.height
})),
error: ApplicationsService.error
});
}
function screenshot(path: string): bool {
const d = DockState.docks[0];
if (!d)
return false;
return input.findChild(d.contentItem, "dockSurface").grabToImage(result => result.saveToFile(path));
}
}
}