From 487dead22138b4313bd35c93373d061b655e9a7d Mon Sep 17 00:00:00 2001 From: filippo-ferrari Date: Sun, 18 Feb 2024 23:42:33 +0100 Subject: [PATCH] feat: touchpad script --- .local/bin/touchpad | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.local/bin/touchpad b/.local/bin/touchpad index dbceff9..9ab6ebd 100755 --- a/.local/bin/touchpad +++ b/.local/bin/touchpad @@ -1,9 +1,21 @@ #!/bin/bash -# xinput disable "Synaptics TM3145-005" -value=$(xinput --list-props "Synaptics TM3145-005" | head -n 2 | tail -c 2) -if [[ $value -eq 0 ]] -then - xinput enable "Synaptics TM3145-005" -else - xinput disable "Synaptics TM3145-005" -fi + + # Check the status of the Bluetooth + bluetooth_status=$(bluetoothctl show | awk '/Powered/ {print $2}') + connected_devices=$(bluetoothctl info | grep -iE 'Connected: yes') + + # Set the icon based on Bluetooth status + if [ "$bluetooth_status" == "yes" ] && [ ! -z "$connected_devices" ]; then + # Bluetooth is on and connected to a device + icon=" " + elif [ "$bluetooth_status" == "yes" ]; then + # Bluetooth is on but not connected to a device + icon="" + else + # Bluetooth is off + icon="❌" + fi + + # Print the icon + echo "$icon" +