Compare commits
2 commits
2027fc92b4
...
852ba53092
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
852ba53092 | ||
|
|
6d3ec188e8 |
4 changed files with 67 additions and 86 deletions
|
|
@ -63,14 +63,6 @@ M.BarSection {
|
||||||
onTriggered: proc.running = true
|
onTriggered: proc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
Process {
|
|
||||||
id: toggle
|
|
||||||
property string cmd: ""
|
|
||||||
command: ["bluetoothctl", "power", cmd]
|
|
||||||
onRunningChanged: if (!running && cmd !== "")
|
|
||||||
proc.running = true
|
|
||||||
}
|
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
icon: "\uF294"
|
icon: "\uF294"
|
||||||
color: root.state === "off" ? M.Theme.base04 : root.accentColor
|
color: root.state === "off" ? M.Theme.base04 : root.accentColor
|
||||||
|
|
@ -84,31 +76,13 @@ M.BarSection {
|
||||||
|
|
||||||
required property var bar
|
required property var bar
|
||||||
|
|
||||||
TapHandler {
|
readonly property bool _anyHover: root._hovered || bluetoothMenu.panelHovered
|
||||||
acceptedButtons: Qt.LeftButton
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
onTapped: {
|
|
||||||
menuLoader.active = !menuLoader.active;
|
|
||||||
M.FlyoutState.visible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TapHandler {
|
|
||||||
acceptedButtons: Qt.RightButton
|
|
||||||
onTapped: {
|
|
||||||
toggle.cmd = root.state === "off" ? "on" : "off";
|
|
||||||
toggle.running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyLoader {
|
|
||||||
id: menuLoader
|
|
||||||
active: false
|
|
||||||
M.BluetoothMenu {
|
M.BluetoothMenu {
|
||||||
accentColor: root.accentColor
|
id: bluetoothMenu
|
||||||
|
showPanel: root._anyHover
|
||||||
screen: root.bar.screen
|
screen: root.bar.screen
|
||||||
anchorX: root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0)
|
anchorItem: root
|
||||||
onDismissed: menuLoader.active = false
|
accentColor: root.accentColor
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,15 +6,18 @@ import "." as M
|
||||||
M.HoverPanel {
|
M.HoverPanel {
|
||||||
id: menuWindow
|
id: menuWindow
|
||||||
|
|
||||||
popupMode: true
|
|
||||||
contentWidth: 250
|
contentWidth: 250
|
||||||
|
panelNamespace: "nova-bluetooth"
|
||||||
|
|
||||||
|
onVisibleChanged: if (visible)
|
||||||
|
scanner.running = true
|
||||||
|
|
||||||
property var _devices: []
|
property var _devices: []
|
||||||
property bool _btEnabled: true
|
property bool _btEnabled: true
|
||||||
|
|
||||||
property Process _scanner: Process {
|
property Process _scanner: Process {
|
||||||
id: scanner
|
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"]
|
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 {
|
stdout: StdioCollector {
|
||||||
onStreamFinished: {
|
onStreamFinished: {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,5 @@ M.BarLabel {
|
||||||
|
|
||||||
font.pixelSize: M.Theme.fontSize + 1
|
font.pixelSize: M.Theme.fontSize + 1
|
||||||
label: Qt.formatDateTime(clock.date, "ddd, dd. MMM HH:mm")
|
label: Qt.formatDateTime(clock.date, "ddd, dd. MMM HH:mm")
|
||||||
minText: "Mi., 00. Sep. 00:00"
|
|
||||||
tooltip: Qt.formatDateTime(clock.date, "dddd, dd. MMMM yyyy\nHH:mm:ss")
|
tooltip: Qt.formatDateTime(clock.date, "dddd, dd. MMMM yyyy\nHH:mm:ss")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,11 @@ M.BarSection {
|
||||||
id: deviceList
|
id: deviceList
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
// Output devices
|
// Output devices — only shown when more than one exists
|
||||||
|
Column {
|
||||||
|
visible: root._sinkList.length > 1
|
||||||
|
width: parent.width
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: parent.width - 16
|
width: parent.width - 16
|
||||||
height: 1
|
height: 1
|
||||||
|
|
@ -257,6 +261,7 @@ M.BarSection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Streams section
|
// Streams section
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue