centralize panel content-change grace period into HoverPanel.keepOpen()

This commit is contained in:
Damocles 2026-04-16 18:37:53 +02:00
parent 084ef1da75
commit 46f14d5d36
6 changed files with 36 additions and 19 deletions

View file

@ -47,6 +47,7 @@ M.BarSection {
property M.ProcessList _procs: M.ProcessList { property M.ProcessList _procs: M.ProcessList {
sortBy: "cpu" sortBy: "cpu"
active: root._showPanel active: root._showPanel
onProcessesChanged: hoverPanel.keepOpen(300)
} }
on_AnyHoverChanged: { on_AnyHoverChanged: {

View file

@ -92,6 +92,24 @@ PanelWindow {
} }
} }
// Content-change grace: call keepOpen(ms) when panel content is about to
// resize/rebuild (session switch, device list change, etc.) to prevent the
// hover-drop-on-resize from closing the panel.
property bool _contentBusy: false
Timer {
id: _contentBusyTimer
onTriggered: {
root._contentBusy = false;
if (!root.showPanel && !root._grace && !root._pinned)
root._hideTimer.restart();
}
}
function keepOpen(ms) {
_contentBusy = true;
_contentBusyTimer.interval = ms ?? 400;
_contentBusyTimer.restart();
}
function _show() { function _show() {
_updatePosition(); _updatePosition();
_winVisible = true; _winVisible = true;
@ -115,7 +133,7 @@ PanelWindow {
Timer { Timer {
id: _hideTimer id: _hideTimer
interval: 150 interval: 150
onTriggered: if (!root.showPanel && !root._grace && !root._pinned) onTriggered: if (!root.showPanel && !root._grace && !root._pinned && !root._contentBusy)
root.dismiss() root.dismiss()
} }

View file

@ -24,6 +24,7 @@ M.BarSection {
property M.ProcessList _procs: M.ProcessList { property M.ProcessList _procs: M.ProcessList {
sortBy: "mem" sortBy: "mem"
active: root._showPanel active: root._showPanel
onProcessesChanged: hoverPanel.keepOpen(300)
} }
on_AnyHoverChanged: { on_AnyHoverChanged: {

View file

@ -75,13 +75,7 @@ M.BarSection {
required property var bar required property var bar
property bool _pinned: false property bool _pinned: false
property bool _switching: false readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered
Timer {
id: _sessionSwitchTimer
interval: 400
onTriggered: root._switching = false
}
readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered || _switching
readonly property bool _showPanel: _anyHover || _pinned readonly property bool _showPanel: _anyHover || _pinned
on_AnyHoverChanged: { on_AnyHoverChanged: {
@ -414,8 +408,7 @@ M.BarSection {
TapHandler { TapHandler {
onTapped: { onTapped: {
root._playerIdx = index; root._playerIdx = index;
root._switching = true; hoverPanel.keepOpen(400);
_sessionSwitchTimer.restart();
} }
} }
} }

View file

@ -98,7 +98,7 @@ M.BarSection {
required property var bar required property var bar
readonly property bool _anyHover: root._hovered || networkMenu.panelHovered || networkMenu._busy readonly property bool _anyHover: root._hovered || networkMenu.panelHovered
M.NetworkMenu { M.NetworkMenu {
id: networkMenu id: networkMenu

View file

@ -12,8 +12,6 @@ M.HoverPanel {
onVisibleChanged: if (visible) onVisibleChanged: if (visible)
scanner.running = true scanner.running = true
readonly property bool _busy: connectProc.running || disconnectProc.running || radioProc.running
function triggerRefresh() { function triggerRefresh() {
if (visible) if (visible)
scanner.running = true; scanner.running = true;
@ -85,24 +83,30 @@ M.HoverPanel {
id: radioProc id: radioProc
property string _state: "" property string _state: ""
command: ["nmcli", "radio", "wifi", _state] command: ["nmcli", "radio", "wifi", _state]
onRunningChanged: if (!running) onRunningChanged: if (!running) {
scanner.running = true scanner.running = true;
menuWindow.keepOpen(500);
}
} }
property Process _connectProc: Process { property Process _connectProc: Process {
id: connectProc id: connectProc
property string uuid: "" property string uuid: ""
command: ["nmcli", "connection", "up", uuid] command: ["nmcli", "connection", "up", uuid]
onRunningChanged: if (!running) onRunningChanged: if (!running) {
scanner.running = true scanner.running = true;
menuWindow.keepOpen(500);
}
} }
property Process _disconnectProc: Process { property Process _disconnectProc: Process {
id: disconnectProc id: disconnectProc
property string uuid: "" property string uuid: ""
command: ["nmcli", "connection", "down", uuid] command: ["nmcli", "connection", "down", uuid]
onRunningChanged: if (!running) onRunningChanged: if (!running) {
scanner.running = true scanner.running = true;
menuWindow.keepOpen(500);
}
} }
// Wi-Fi radio toggle header // Wi-Fi radio toggle header