Added AGS

This commit is contained in:
2026-04-19 21:28:21 -04:00
parent 24dd3e0271
commit 5fbf61834a
10 changed files with 278 additions and 34 deletions
+45
View File
@@ -0,0 +1,45 @@
const mpris = await Service.import('mpris');
const Media = () => Widget.Box({
class_name: 'media-container',
spacing: 10,
children: [
Widget.Button({
class_name: 'media-btn',
on_clicked: () => mpris.players[0]?.previous(),
child: Widget.Label('⏮'),
}),
Widget.Button({
class_name: 'media-btn',
on_clicked: () => mpris.players[0]?.playPause(),
child: Widget.Label().hook(mpris, label => {
const player = mpris.players[0];
label.label = player?.play_back_status === 'Playing' ? '⏸' : '▶';
}),
}),
Widget.Button({
class_name: 'media-btn',
on_clicked: () => mpris.players[0]?.next(),
child: Widget.Label('⏭'),
}),
Widget.Label({
class_name: 'media-text',
}).hook(mpris, label => {
const player = mpris.players[0];
label.label = player ? `${player.track_title} - ${player.track_artists.join(', ')}` : 'No Media Playing';
}),
],
});
App.config({
style: './style.css',
windows: [
Widget.Window({
name: 'media_widget',
anchor: ['bottom', 'left'],
margins: [0, 0, 20, 20],
layer: 'bottom',
child: Media(),
})
]
});