Files
custum-hyprpanel/modules/menus/audio/available/PlaybackDevices.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

60 lines
2.4 KiB
TypeScript

const audio = await Service.import("audio");
import { Stream } from "types/service/audio";
const renderPlaybacks = (playbackDevices: Stream[]) => {
return playbackDevices.map((device) => {
if (device.description === "Dummy Output") {
return Widget.Box({
class_name: "menu-unfound-button playback",
child: Widget.Box({
children: [
Widget.Label({
class_name: "menu-button-name playback",
label: "No playback devices found...",
}),
],
}),
});
}
return Widget.Button({
class_name: `menu-button audio playback ${device}`,
on_primary_click: () => (audio.speaker = device),
child: Widget.Box({
children: [
Widget.Box({
hpack: "start",
children: [
Widget.Label({
truncate: "end",
wrap: true,
class_name: audio.speaker
.bind("description")
.as((v) =>
device.description === v
? "menu-button-icon active playback txt-icon"
: "menu-button-icon playback txt-icon",
),
label: "",
}),
Widget.Label({
truncate: "end",
wrap: true,
class_name: audio.speaker
.bind("description")
.as((v) =>
device.description === v
? "menu-button-name active playback"
: "menu-button-name playback",
),
label: device.description,
}),
],
}),
],
}),
});
});
};
export { renderPlaybacks };