aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nixos/environment.nix1
-rw-r--r--quickshell/Procs.qml18
-rw-r--r--quickshell/items/LowEnergy.qml27
-rwxr-xr-xquickshell/scripts/bluetooth.sh9
-rw-r--r--quickshell/shell.qml7
5 files changed, 62 insertions, 0 deletions
diff --git a/nixos/environment.nix b/nixos/environment.nix
index 1175993..b575b96 100644
--- a/nixos/environment.nix
+++ b/nixos/environment.nix
@@ -29,6 +29,7 @@
delta
tokei
wiki-tui
+ bluetui
fastfetch
pipes
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 {}