mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-23 01:52:46 +00:00
feat: update system
This commit is contained in:
@@ -26,31 +26,24 @@ const Indicator = ({ player, direction = "right" }) =>
|
||||
vexpand: true,
|
||||
truncate: "end",
|
||||
max_width_chars: 40,
|
||||
connections: [
|
||||
[
|
||||
player,
|
||||
(label) => {
|
||||
label.label = `${player.track_artists.join(", ")} - ${
|
||||
player.track_title
|
||||
}`;
|
||||
},
|
||||
],
|
||||
],
|
||||
label: player
|
||||
.bind("track_title")
|
||||
.transform(
|
||||
() => `${player.track_artists.join(", ")} - ${player.track_title}`,
|
||||
),
|
||||
}),
|
||||
connections: [
|
||||
[
|
||||
player,
|
||||
(revealer) => {
|
||||
if (revealer._current === player.track_title) return;
|
||||
setupRevealer: (self) => {
|
||||
let current = "";
|
||||
self.hook(player, () => {
|
||||
if (current === player.track_title) return;
|
||||
|
||||
revealer._current = player.track_title;
|
||||
revealer.reveal_child = true;
|
||||
Utils.timeout(3000, () => {
|
||||
revealer.reveal_child = false;
|
||||
});
|
||||
},
|
||||
],
|
||||
],
|
||||
current = player.track_title;
|
||||
self.reveal_child = true;
|
||||
Utils.timeout(3000, () => {
|
||||
self.reveal_child = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -75,10 +68,7 @@ export default ({ direction = "right" } = {}) => {
|
||||
box.children = [Indicator({ player, direction })];
|
||||
};
|
||||
|
||||
return Widget.Box({
|
||||
connections: [
|
||||
[options.mpris.preferred, update],
|
||||
[Mpris, update, "notify::players"],
|
||||
],
|
||||
});
|
||||
return Widget.Box()
|
||||
.hook(options.mpris.preferred, update)
|
||||
.hook(Mpris, update, "notify::players");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user