From d95c1347171965891fcb24023afbc8c462e1a920 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sun, 4 May 2025 22:34:49 +1000 Subject: osd: pause hide on hover --- modules/osd/Osd.qml | 19 ++++++++++++++++++- services/Hyprland.qml | 6 ++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/modules/osd/Osd.qml b/modules/osd/Osd.qml index 4d6ab7e..33a12ab 100644 --- a/modules/osd/Osd.qml +++ b/modules/osd/Osd.qml @@ -13,6 +13,7 @@ Variants { required property ShellScreen modelData readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(modelData) property bool osdVisible + property bool hovered function show(): void { root.osdVisible = true; @@ -43,7 +44,10 @@ Variants { id: timer interval: OsdConfig.hideDelay - onTriggered: root.osdVisible = false + onTriggered: { + if (!root.hovered) + root.osdVisible = false; + } } LazyLoader { @@ -91,6 +95,19 @@ Variants { monitor: root.monitor } } + + HoverHandler { + id: hoverHandler + + parent: win + onHoveredChanged: { + root.hovered = hovered; + if (hovered) + timer.stop(); + else + root.osdVisible = false; + } + } } } } diff --git a/services/Hyprland.qml b/services/Hyprland.qml index 481ee7c..f0a0a97 100644 --- a/services/Hyprland.qml +++ b/services/Hyprland.qml @@ -40,8 +40,9 @@ Singleton { Process { id: getClients - command: ["sh", "-c", "hyprctl -j clients | jq -c"] + command: ["hyprctl", "-j", "clients"] stdout: SplitParser { + splitMarker: "" onRead: data => { const clients = JSON.parse(data); const rClients = root.clients; @@ -69,8 +70,9 @@ Singleton { Process { id: getActiveClient - command: ["sh", "-c", "hyprctl -j activewindow | jq -c"] + command: ["hyprctl", "-j", "activewindow"] stdout: SplitParser { + splitMarker: "" onRead: data => { const client = JSON.parse(data); root.activeClient = client.address ? clientComp.createObject(root, { -- cgit v1.2.3-freya