~tardypad/dotfiles

ref: 7dd5e02494e2821ff6b4fd5758a590ef03b5403b dotfiles/packages/i3blocks/scripts/bluetooth -rwxr-xr-x 432 bytes
7dd5e024 — Damien Tardy-Panis add mako package config 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /usr/bin/env zsh

# #TODO: take into account multiple connected devices

BLUETOOTH_INFO=$( bluetoothctl info )

# only display something if a device is connected
if ! echo "${BLUETOOTH_INFO}" \
     | grep --quiet 'Connected: yes'; then
  exit 0
fi

BLUETOOTH_DEVICE_ALIAS=$(
  echo "${BLUETOOTH_INFO}" \
    | sed -n 's/.*Alias: \(.*\)/\1/p'
)

echo "<span foreground='#{color/base0A/hex}'></span> ${BLUETOOTH_DEVICE_ALIAS}"