Files
glassMxrph/quickshell/services/HyprlandService.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

66 lines
2.6 KiB
QML

pragma Singleton
import QtQuick
import Quickshell
import Quickshell.Hyprland
Singleton {
id: root
readonly property var visibleWorkspaces: Hyprland.workspaces.values.filter(w => w.active).map(w => w.id)
readonly property var windows: Hyprland.toplevels.values.map(t => {
const info = t.lastIpcObject || {};
return {
address: t.address,
handle: t.wayland,
appId: t.wayland ? t.wayland.appId : info.class || "",
initialClass: info.initialClass || "",
title: t.title,
active: t.activated,
monitor: t.monitor ? t.monitor.name : "",
workspace: t.workspace ? t.workspace.id : 0,
x: info.at ? info.at[0] : 0,
y: info.at ? info.at[1] : 0,
width: info.size ? info.size[0] : 0,
height: info.size ? info.size[1] : 0,
hidden: info.hidden === true || info.mapped === false,
fullscreen: info.fullscreen === 2,
floating: info.floating === true
};
}).filter(w => !w.hidden)
// Monitors whose desktop is hidden: a tiled or fullscreen window sits on
// their active workspace. Desktop widgets pause animation and sampling there.
readonly property var coveredMonitors: windows.filter(w => visibleWorkspaces.includes(w.workspace) && (!w.floating || w.fullscreen)).map(w => w.monitor)
readonly property bool needsGeometry: ConfigService.ready && ConfigService.data.dock.enabled && ConfigService.data.dock.visibility === "intelligent"
function focusWindow(address) {
const window = windows.find(w => w.address === address);
if (!window)
return false;
if (window.handle)
window.handle.activate();
else if (/^(0x)?[0-9a-f]+$/i.test(address))
Hyprland.dispatch("focuswindow address:" + (address.startsWith("0x") ? address : "0x" + address));
else
return false;
return true;
}
function closeWindow(address) {
const window = windows.find(w => w.address === address);
if (!window)
return false;
if (window.handle)
window.handle.close();
else if (/^(0x)?[0-9a-f]+$/i.test(address))
Hyprland.dispatch("closewindow address:" + (address.startsWith("0x") ? address : "0x" + address));
else
return false;
return true;
}
// Native IPC, not subprocess polling. Hyprland emits no continuous resize event.
Timer {
interval: 500
repeat: true
running: root.needsGeometry
triggeredOnStart: true
onTriggered: Hyprland.refreshToplevels()
}
}