snowflake/home/programs/ags/config/js/widgets/music.js
notohh 502c926f9f
WIP: treewide: refactor to use flake-parts
first pass of my flake refactor using flake-parts
2024-04-16 21:02:33 -04:00

20 lines
481 B
JavaScript

import { Mpris, Widget } from "../../import.js";
const Media = () =>
Widget.Box({
class_name: "media",
child: Widget.Label("-").hook(
Mpris,
(self) => {
if (Mpris.players[0]) {
const { track_artists, track_title } = Mpris.players[0];
self.label = `${track_artists.join(", ")} - ${track_title}`;
} else {
self.label = "Nothing is playing";
}
},
"player-changed"
)
});
export { Media };