mirror of
https://github.com/kmein/niveum
synced 2026-03-19 11:31:09 +01:00
feat: dmenubluetooth
This commit is contained in:
@@ -119,6 +119,7 @@
|
|||||||
scripts.notetags
|
scripts.notetags
|
||||||
scripts.booksplit
|
scripts.booksplit
|
||||||
scripts.dmenurandr
|
scripts.dmenurandr
|
||||||
|
scripts.dmenubluetooth
|
||||||
scripts.manual-sort
|
scripts.manual-sort
|
||||||
ts
|
ts
|
||||||
scripts.vg
|
scripts.vg
|
||||||
|
|||||||
@@ -97,6 +97,12 @@ in rec {
|
|||||||
script = ./dmenurandr.sh;
|
script = ./dmenurandr.sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dmenubluetooth = wrapScript {
|
||||||
|
packages = [ pkgs.bluez5 pkgs.dmenu pkgs.libnotify ];
|
||||||
|
name = "dmenubluetooth";
|
||||||
|
script = ./dmenubluetooth.sh;
|
||||||
|
};
|
||||||
|
|
||||||
fkill = wrapScript {
|
fkill = wrapScript {
|
||||||
packages = [ pkgs.procps pkgs.gawk pkgs.gnused pkgs.fzf pkgs.bash ];
|
packages = [ pkgs.procps pkgs.gawk pkgs.gnused pkgs.fzf pkgs.bash ];
|
||||||
script = ./fkill.sh;
|
script = ./fkill.sh;
|
||||||
|
|||||||
22
packages/scripts/dmenubluetooth.sh
Executable file
22
packages/scripts/dmenubluetooth.sh
Executable file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# UI for connecting to bluetooth devices
|
||||||
|
|
||||||
|
bluetooth_notify() {
|
||||||
|
notify-send --app-name=" Bluetooth" "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
bluetoothctl --timeout 1 -- scan on
|
||||||
|
|
||||||
|
bluetooth_devices="$(bluetoothctl devices | cut -d ' ' -f2-)"
|
||||||
|
|
||||||
|
chosen="$(echo "$bluetooth_devices" | dmenu -i -l 5 -p "Bluetooth device")"
|
||||||
|
chosen_name="$(echo "$chosen" | cut -d ' ' -f2-)"
|
||||||
|
|
||||||
|
bluetooth_notify "$chosen_name" "Connecting ..."
|
||||||
|
|
||||||
|
if bluetoothctl connect "$(echo "$chosen" | cut -d ' ' -f1)"
|
||||||
|
then
|
||||||
|
bluetooth_notify "✔ $chosen_name" "Connected to device."
|
||||||
|
else
|
||||||
|
test "$chosen" && bluetooth_notify "❌ $chosen_name" "Failed to connect to device."
|
||||||
|
fi
|
||||||
Reference in New Issue
Block a user