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

@ -6,15 +6,18 @@ import "." as M
M.HoverPanel {
id: menuWindow
popupMode: true
contentWidth: 250
panelNamespace: "nova-bluetooth"
onVisibleChanged: if (visible)
scanner.running = true
property var _devices: []
property bool _btEnabled: true
property Process _scanner: Process {
id: scanner
running: true
running: false
command: ["sh", "-c", "bluetoothctl show 2>/dev/null | awk '/Powered:/{print $2; exit}';" + "echo '---DEVICES---';" + "bluetoothctl devices Paired 2>/dev/null | while read -r _ mac name; do " + "info=$(bluetoothctl info \"$mac\" 2>/dev/null); " + "conn=$(echo \"$info\" | grep -c 'Connected: yes'); " + "bat=$(echo \"$info\" | awk -F'[(): ]' '/Battery Percentage/{for(i=1;i<=NF;i++) if($i+0==$i && $i!=\"\") print $i}'); " + "echo \"$mac:$conn:${bat:-}:$name\"; " + "done"]
stdout: StdioCollector {
onStreamFinished: {