bluetooth: switch to hover panel, matching network behavior

This commit is contained in:
Damocles 2026-04-16 00:12:31 +02:00
parent 2027fc92b4
commit 6d3ec188e8
2 changed files with 12 additions and 35 deletions

View file

@ -63,14 +63,6 @@ M.BarSection {
onTriggered: proc.running = true
}
Process {
id: toggle
property string cmd: ""
command: ["bluetoothctl", "power", cmd]
onRunningChanged: if (!running && cmd !== "")
proc.running = true
}
M.BarIcon {
icon: "\uF294"
color: root.state === "off" ? M.Theme.base04 : root.accentColor
@ -84,31 +76,13 @@ M.BarSection {
required property var bar
TapHandler {
acceptedButtons: Qt.LeftButton
cursorShape: Qt.PointingHandCursor
onTapped: {
menuLoader.active = !menuLoader.active;
M.FlyoutState.visible = false;
}
}
readonly property bool _anyHover: root._hovered || bluetoothMenu.panelHovered
TapHandler {
acceptedButtons: Qt.RightButton
onTapped: {
toggle.cmd = root.state === "off" ? "on" : "off";
toggle.running = true;
}
}
LazyLoader {
id: menuLoader
active: false
M.BluetoothMenu {
accentColor: root.accentColor
screen: root.bar.screen
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
onDismissed: menuLoader.active = false
}
M.BluetoothMenu {
id: bluetoothMenu
showPanel: root._anyHover
screen: root.bar.screen
anchorItem: root
accentColor: root.accentColor
}
}