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>
108 lines
3.8 KiB
QML
108 lines
3.8 KiB
QML
import QtQuick
|
|
import QtTest
|
|
import Quickshell.Io
|
|
import "../launcher"
|
|
import "../core"
|
|
import "../theme"
|
|
|
|
Item {
|
|
id: root
|
|
parent: LauncherState.window ? LauncherState.window.contentItem : null
|
|
function search() {
|
|
return input.findChild(LauncherState.window.contentItem, "launcherSearch");
|
|
}
|
|
TestCase {
|
|
id: input
|
|
name: "LauncherInputDriver"
|
|
when: false
|
|
}
|
|
// The panel grows to fit results; wait for it to settle before pointing.
|
|
function settle(): void {
|
|
const panel = input.findChild(LauncherState.window.contentItem, "launcherSurface");
|
|
let last = -1;
|
|
for (let i = 0; i < 40 && panel.height !== last; i++) {
|
|
last = panel.height;
|
|
input.wait(Math.max(50, Theme.duration / 2));
|
|
}
|
|
}
|
|
IpcHandler {
|
|
target: "launcherTest"
|
|
function query(text: string): void {
|
|
const field = root.search();
|
|
field.text = text;
|
|
field.forceActiveFocus();
|
|
}
|
|
function key(key: int): void {
|
|
input.keyClick(key);
|
|
}
|
|
function typeAscii(text: string): void {
|
|
for (let i = 0; i < text.length; i++)
|
|
input.keyClick(text.charAt(i).toUpperCase().charCodeAt(0));
|
|
}
|
|
function snapshot(): string {
|
|
const w = LauncherState.window, panel = input.findChild(w.contentItem, "launcherSurface");
|
|
return JSON.stringify({
|
|
activeMonitor: ScreenService.active ? ScreenService.active.name : "",
|
|
opened: ShellState.launcherOpen,
|
|
screen: w.screen.name,
|
|
screenWidth: w.width,
|
|
screenHeight: w.height,
|
|
x: panel.x,
|
|
y: panel.y,
|
|
width: panel.width,
|
|
height: panel.height,
|
|
visible: w.visible,
|
|
query: root.search().text,
|
|
focused: root.search().activeFocus,
|
|
selected: w.selectedIndex,
|
|
results: w.results.map(r => ({
|
|
id: r.id,
|
|
title: r.title,
|
|
command: !!r.command
|
|
})),
|
|
error: w.launchError
|
|
});
|
|
}
|
|
function click(index: int): bool {
|
|
root.settle();
|
|
const list = input.findChild(LauncherState.window.contentItem, "launcherResults");
|
|
list.positionViewAtIndex(index, ListView.Contain);
|
|
const row = list.itemAtIndex(index);
|
|
if (!row)
|
|
return false;
|
|
input.mouseClick(row, row.width / 2, row.height / 2);
|
|
return true;
|
|
}
|
|
function hover(index: int): bool {
|
|
root.settle();
|
|
const list = input.findChild(LauncherState.window.contentItem, "launcherResults");
|
|
const row = list.itemAtIndex(index);
|
|
if (!row)
|
|
return false;
|
|
input.mouseMove(row, row.width / 2, row.height / 2);
|
|
return true;
|
|
}
|
|
function outside(): void {
|
|
input.mouseClick(LauncherState.window.contentItem, 5, 5);
|
|
}
|
|
function browse(): void {
|
|
LauncherState.window.toggleBrowse();
|
|
}
|
|
function screenshot(path: string): bool {
|
|
return input.findChild(LauncherState.window.contentItem, "launcherSurface").grabToImage(result => result.saveToFile(path));
|
|
}
|
|
function extension(add: bool): bool {
|
|
if (!add) {
|
|
CommandRegistry.unregisterCommand("fixture");
|
|
return true;
|
|
}
|
|
return CommandRegistry.registerCommand({
|
|
id: "fixture",
|
|
title: "Fixture command",
|
|
description: "Test extension",
|
|
run: () => ShellState.openSettings("about")
|
|
});
|
|
}
|
|
}
|
|
}
|