pragma Singleton import Quickshell import Quickshell.Hyprland import QtQuick import "../modules/osd/OsdModel.js" as OsdModel Singleton { id: root property bool active: false property string monitorName: "" property var state: OsdModel.messageState("dialog-information-symbolic", "", 1400) function present(next: var): void { root.state = next; root.monitorName = Hyprland.focusedMonitor?.name ?? ""; root.active = true; if (next.duration > 0) { hideTimer.interval = next.duration; hideTimer.restart(); } else { hideTimer.stop(); } } function progress(kind: string, value: int, maximum: int, label: string): void { root.present(OsdModel.progressState(kind, value, maximum, label, 1400)); } function message(kind: string, label: string): void { root.present(OsdModel.messageState(kind, label, 1400)); } function hide(): void { hideTimer.stop(); root.active = false; } Timer { id: hideTimer interval: 1400 onTriggered: root.active = false } }