diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-05-10 16:36:21 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-05-10 16:36:21 +0530 |
| commit | cd88149245daf8ee8b93bb1cc84e2ab391cc2a1d (patch) | |
| tree | 1226b2d3493d407234f5210746ab277252c04078 /quickshell | |
| parent | ce5908ed1c96ac3e8cf9e9aa471441a1d653ab3b (diff) | |
proper bluetooth integration
Diffstat (limited to 'quickshell')
| -rw-r--r-- | quickshell/Procs.qml | 18 | ||||
| -rw-r--r-- | quickshell/items/LowEnergy.qml | 27 | ||||
| -rwxr-xr-x | quickshell/scripts/bluetooth.sh | 9 | ||||
| -rw-r--r-- | quickshell/shell.qml | 7 |
4 files changed, 61 insertions, 0 deletions
diff --git a/quickshell/Procs.qml b/quickshell/Procs.qml index c26c312..f24bec6 100644 --- a/quickshell/Procs.qml +++ b/quickshell/Procs.qml @@ -14,6 +14,7 @@ Scope { volumeProc.running = true batteryProc.running = true networkProc.running = true + bluetoothProc.running = true temperatureProc.running = true } } @@ -116,4 +117,21 @@ Scope { } Component.onCompleted: running = true } + + Process { + id: bluetoothProc + command: ["sh", "-c", "~/.config/quickshell/scripts/bluetooth.sh"] + stdout: SplitParser { + onRead: data => { + data = data.trim() + if (data == "Offline") { + bluetoothName = "Offline" + return + } + var parts = data.split(" ") + bluetoothName = parts.slice(2).join(" ") + } + } + Component.onCompleted: running = true + } } diff --git a/quickshell/items/LowEnergy.qml b/quickshell/items/LowEnergy.qml new file mode 100644 index 0000000..881ee84 --- /dev/null +++ b/quickshell/items/LowEnergy.qml @@ -0,0 +1,27 @@ +import QtQuick +import QtQuick.Layouts + +RowLayout { + spacing: 0 + Text { + text: " Low Energy:" + color: shellRoot.white + font { + family: shellRoot.fontFamily + pixelSize: shellRoot.fontSize + } + } + Text { + text: bluetoothName + color: bluetoothName == "Offline" ? shellRoot.red : shellRoot.green + font { + family: shellRoot.fontFamily + pixelSize: shellRoot.fontSize + bold: true + } + } + MouseArea { + anchors.fill: parent + onClicked: bluetoothManagerProc.running = true + } +} diff --git a/quickshell/scripts/bluetooth.sh b/quickshell/scripts/bluetooth.sh new file mode 100755 index 0000000..861e4a3 --- /dev/null +++ b/quickshell/scripts/bluetooth.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +connected="$(bluetoothctl devices Connected)" + +if [ -z "$connected" ]; then + echo "Offline" +else + echo "$connected" +fi diff --git a/quickshell/shell.qml b/quickshell/shell.qml index 2664ac3..369a87c 100644 --- a/quickshell/shell.qml +++ b/quickshell/shell.qml @@ -61,6 +61,7 @@ ShellRoot { property int battery: 12 property bool batteryCharging: false property string wifiName: "Offline" + property string bluetoothName: "Offline" Procs {} Process { @@ -68,6 +69,11 @@ ShellRoot { command: ["foot", "-e", "nmtui"] Component.onCompleted: running = false } + Process { + id: bluetoothManagerProc + command: ["foot", "-e", "bluetui"] + Component.onCompleted: running = false + } anchors.bottom: true anchors.left: true @@ -84,6 +90,7 @@ ShellRoot { Workspace {} Item { Layout.fillWidth: true } Radio {} + LowEnergy {} Electrons {} Waves {} Photons {} |
