Bettertouchtool 1 11111111 114/25/2023 ![]() Lets extract only the line with that device ![]() The script in "~/.dotfiles/shell/device_battery_level.sh" then looks like this: #!/bin/shĭEVICES=$(ioreg -r -l -n AppleHSBluetoothDevice | egrep '"BatteryPercent" = |^ \| "Bluetooth Product Name" = ') #Lets get a list of all bluetooth devicesĭEVICELINE=$(grep -n "$1" <<< "$DEVICES") #$1 is the device that this script was called with. For me this was preferred over displaying "No device". If the shell script outputs an empty script no widget will be displayed. The name provided in the variable "devicename" is used as a argument to the script and is the name that the script will look for in ioreg. "" -No device present = no output to touchbarĭisplayname
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |