testing ags

This commit is contained in:
cnst
2024-07-15 14:39:56 +02:00
parent 91e09c461b
commit 2f32e46601
55 changed files with 2218 additions and 22 deletions

View File

@@ -0,0 +1,27 @@
import { Bluetooth, Icons } from "../imports.js";
export const getBluetoothDevice = (addr) =>
Bluetooth.getDevice(addr).alias ?? Bluetooth.getDevice(addr).name;
export const getBluetoothIcon = (connected) => {
if (!Bluetooth.enabled) return Icons.bluetooth.disabled;
if (connected.length > 0) return Icons.bluetooth.active;
return Icons.bluetooth.disconnected;
};
export const getBluetoothText = (connected) => {
if (!Bluetooth.enabled) return "Bluetooth off";
if (connected.length > 0) {
const dev = Bluetooth.getDevice(connected[0].address);
let battery_str = "";
if (dev.battery_percentage > 0) {
battery_str += ` ${dev.battery_percentage}%`;
}
return dev.name + battery_str;
}
return "Bluetooth on";
};