Seite 1 von 1

Bluetooth (rfkill) toggle mit Tastenkombination ein/ausschalten

Verfasst: Sonntag 28. Januar 2024, 12:46
von country
Mir war langweilig und hab mal mein erstes "script" geschrieben

Code: Alles auswählen

#!/bin/bash
x="rfkill list bluetooth | grep -i yes | awk '{print $3}'" 
eval "$x"    
y=$(eval "$x")   
if [[ $y = *yes ]]; then
	echo "bt is off"
	rfkill unblock bluetooth
else
	echo "bt is on"
	rfkill block bluetooth
fi

Funktioniert wenn man das Script zB. die Tastenkombination CTRL+B zuweist beim drücken wird Bluetooth aktiviert wenn man nochmal drück wird Bluetooth deaktiviert.

Das ganze auf Archlinux Cinnamon