initial commit
This commit is contained in:
commit
9fde6d4fc6
27 changed files with 1110 additions and 0 deletions
38
modules/Bluetooth.qml
Normal file
38
modules/Bluetooth.qml
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import QtQuick
|
||||
import Quickshell.Io
|
||||
import "." as M
|
||||
|
||||
Row {
|
||||
id: root
|
||||
spacing: 4
|
||||
|
||||
property string status: "off"
|
||||
property string device: ""
|
||||
|
||||
Process {
|
||||
id: proc
|
||||
running: true
|
||||
command: ["sh", "-c", "bluetoothctl info 2>/dev/null | awk -F': ' '/Name/ {n=$2} /Connected: yes/ {c=1} END {if (c) print n; else print \"\"}'"]
|
||||
stdout: StdioCollector {
|
||||
onStreamFinished: {
|
||||
const t = text.trim();
|
||||
root.device = t;
|
||||
root.status = t ? "connected" : "on";
|
||||
}
|
||||
}
|
||||
}
|
||||
Timer {
|
||||
interval: 10000
|
||||
running: true
|
||||
repeat: true
|
||||
onTriggered: proc.running = true
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.status === "connected" ? (" " + root.device) : ""
|
||||
color: M.Theme.base05
|
||||
font.pixelSize: M.Theme.fontSize + 1
|
||||
font.family: M.Theme.fontFamily
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue