nosignal-shell/services/Hyprland.qml
2025-06-27 21:37:15 +10:00

37 lines
1.1 KiB
QML

pragma Singleton
import Quickshell
import Quickshell.Hyprland
import QtQuick
Singleton {
id: root
readonly property var toplevels: Hyprland.toplevels
readonly property var workspaces: Hyprland.workspaces
readonly property var monitors: Hyprland.monitors
readonly property HyprlandToplevel activeToplevel: Hyprland.activeToplevel
readonly property HyprlandWorkspace focusedWorkspace: Hyprland.focusedWorkspace
readonly property HyprlandMonitor focusedMonitor: Hyprland.focusedMonitor
readonly property int activeWsId: focusedWorkspace?.id ?? 1
function dispatch(request: string): void {
Hyprland.dispatch(request);
}
Connections {
target: Hyprland
function onRawEvent(event: HyprlandEvent): void {
if (event.name.endsWith("v2"))
return;
if (event.name.includes("mon"))
Hyprland.refreshMonitors();
else if (event.name.includes("workspace"))
Hyprland.refreshWorkspaces();
else
Hyprland.refreshToplevels();
}
}
}