snowflake/home/ags/config/js/widgets/music.js
notohh a9626cfd89
All checks were successful
flake check / check (push) Successful in 9m47s
fmt check / check (push) Successful in 1m14s
ags: updates
2024-01-03 17:08:17 -05:00

17 lines
No EOL
458 B
JavaScript

import { Widget, Mpris } 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
}