2024-02-01 15:48:47 -05:00
|
|
|
import { Mpris, Widget } from "../../import.js";
|
2024-01-03 17:08:17 -05:00
|
|
|
|
2024-02-01 15:48:47 -05:00
|
|
|
const Media = () =>
|
|
|
|
Widget.Box({
|
|
|
|
class_name: "media",
|
2024-02-01 17:48:30 -05:00
|
|
|
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"
|
|
|
|
)
|
2024-02-01 15:48:47 -05:00
|
|
|
});
|
2024-01-03 17:08:17 -05:00
|
|
|
|
2024-02-01 15:48:47 -05:00
|
|
|
export { Media };
|