Files
custum-hyprpanel/modules/bar/bluetooth/index.ts
Jas Singh b200b6fadb Fix NerdFont icon alignments. (#143)
* WIP

* Fix nerdfont icon alignments

* Ship needed fonts

* Remove italicised fonts

* Update readme and separate OSD settings into their own category.

* Dashboard styling updates

---------

Co-authored-by: matavach <erik@matijevich.org>
2024-08-18 00:32:22 -07:00

48 lines
1.4 KiB
TypeScript

const bluetooth = await Service.import('bluetooth')
import Gdk from 'gi://Gdk?version=3.0';
import options from "options";
import { openMenu } from "../utils.js";
const Bluetooth = () => {
const btIcon = Widget.Label({
label: bluetooth.bind("enabled").as((v) => v ? "󰂯" : "󰂲"),
class_name: "bar-button-icon bluetooth txt-icon bar",
});
const btText = Widget.Label({
label: Utils.merge([
bluetooth.bind("enabled"),
bluetooth.bind("connected_devices"),
],
(btEnabled, btDevices) => {
return btEnabled && btDevices.length ? ` Connected (${btDevices.length})`
: btEnabled ? "On"
: "Off"
}),
class_name: "bar-button-label bluetooth",
});
return {
component: Widget.Box({
class_name: "volume",
children: options.bar.bluetooth.label.bind("value").as((showLabel) => {
if (showLabel) {
return [btIcon, btText];
}
return [btIcon];
}),
}),
isVisible: true,
boxClass: "bluetooth",
props: {
on_primary_click: (clicked: any, event: Gdk.Event) => {
openMenu(clicked, event, "bluetoothmenu");
},
},
};
}
export { Bluetooth }