feat: extend bluetooth module

This commit is contained in:
Daan Goossens
2022-05-02 18:11:21 +02:00
parent caee2e611f
commit 638b4e6573
6 changed files with 497 additions and 49 deletions

View File

@ -6,21 +6,44 @@ waybar - bluetooth module
# DESCRIPTION
The *bluetooth* module displays information about the status of the device's bluetooth device.
The *bluetooth* module displays information about the bluetooth adapter and its connections.
# CONFIGURATION
Addressed by *bluetooth*
*adapter-alias*: ++
typeof: string ++
Use the adapter with the defined alias (name). Otherwise select a random adapter to display. Recommended to define when there is more than 1 adapter available to the system (use ```bluetoothctl show``` to show all available adapters).
*format-device-preference*: ++
typeof: array ++
A ranking of bluetooth devices, addressed by their alias (name). The order is *first displayed* to *last displayed*. If this config option is not defined or none of the devices in the list are connected, it will fall back to showing the last connected device. A devices alias can be manually changed using the ```bluetoothctl set-alias``` command.
*format*: ++
typeof: string ++
default: *{icon}* ++
default: * {status}* ++
The format, how information should be displayed. This format is used when other formats aren't specified.
*format-icons*: ++
typeof: array/object ++
Based on the device status, the corresponding icon gets selected. ++
The order is *low* to *high*. Or by the state if it is an object.
*format-disabled*: ++
typeof: string ++
This format is used when the displayed adapter is disabled.
*format-off*: ++
typeof: string ++
This format is used when the displayed adapter is turned off.
*format-on*: ++
typeof: string ++
This format is used when the displayed adapter is turned on with no devices connected.
*format-connected*: ++
typeof: string ++
This format is used when the displayed adapter is connected to at least 1 device.
*format-connected-battery*: ++
typeof: string ++
This format is used when the selected connected device, defined by the config option *format-device-preference*, provides is battery percentage. This needs the experimental features of bluez to be enabled to work.
*rotate*: ++
typeof: integer ++
@ -71,23 +94,65 @@ Addressed by *bluetooth*
typeof: string ++
The format, how information should be displayed in the tooltip. This format is used when other formats aren't specified.
*tooltip-format-disabled*: ++
typeof: string ++
This format is used when the displayed adapter is disabled.
*tooltip-format-off*: ++
typeof: string ++
This format is used when the displayed adapter is turned off.
*tooltip-format-on*: ++
typeof: string ++
This format is used when the displayed adapter is turned on with no devices connected.
*tooltip-format-connected*: ++
typeof: string ++
This format is used when the displayed adapter is connected to at least 1 device.
*tooltip-format-connected-battery*: ++
typeof: string ++
This format is used when the selected connected device, defined by the config option *format-device-preference*, provides is battery percentage. This needs the experimental features of bluez to be enabled to work.
# FORMAT REPLACEMENTS
*{status}*: Status of the bluetooth device.
*{icon}*: Icon, as defined in *format-icons*.
*{num_connections}*: Number of connections the selected adapter has.
*{adapter_address}*: Address of the selected adapter.
*{adapter_address_type}*: Address type of the selected adapter.
*{adapter_alias}*: Alias of the selected adapter. By default equal to the *adapter_name* but can be changed by the user when there are conflicts.
*{device_address}*: Address of the current selected selected connected device.
*{device_address_type}*: Address type of the current selected selected connected device.
*{device_alias}*: Alias of the current selected connected device. By default equal to the *device_name* but can be changed by the user when there are conflicts.
*{device_battery_percentage}*: Battery percentage of the current selected device if available. Only use in the *format-connected-battery* and *tooltip-format-connected-battery*.
# EXAMPLES
```
"bluetooth": {
"format": "{icon}",
"format-alt": "bluetooth: {status}",
"format-icons": {
"enabled": "",
"disabled": ""
},
"tooltip-format": "{}"
"format": " {status}",
"format-connected": " {device_alias}",
"format-connected-battery": " {device_battery_percentage}%",
"tooltip-format": "{adapter_alias} {adapter_address}"
}
```
```
"bluetooth": {
// "adapter-alias": "adapter1", // specify the adapter alias (name) if there are more than 1 on the system
"format": " {status}",
"format-connected": " {num_connections} connected",
// TODO: make it so that it shows all connected devices in the tooltip
// "tooltip-format-connected": "{device_alias}",
// "tooltip-format-connected-battery": "{device_alias} {device_battery_percentage}%",
}
```
@ -95,3 +160,9 @@ Addressed by *bluetooth*
- *#bluetooth*
- *#bluetooth.disabled*
- *#bluetooth.off*
- *#bluetooth.on*
- *#bluetooth.connected*
- *#bluetooth.discoverable*
- *#bluetooth.discovering*
- *#bluetooth.pairable*