summaryrefslogtreecommitdiff
path: root/src/services/updates.ts
diff options
context:
space:
mode:
author2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-25 15:33:08 +1100
committer2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>2025-02-25 15:33:08 +1100
commit01626b70f10b38a6c03e5701283a43e9920fc26d (patch)
tree0042e856dc30df6760e81a245cac977b2abd3dd7 /src/services/updates.ts
parentlauncher: italic xwayland windows (diff)
downloadcaelestia-shell-01626b70f10b38a6c03e5701283a43e9920fc26d.tar.gz
caelestia-shell-01626b70f10b38a6c03e5701283a43e9920fc26d.tar.bz2
caelestia-shell-01626b70f10b38a6c03e5701283a43e9920fc26d.zip
updates: show arch news
Diffstat (limited to 'src/services/updates.ts')
-rw-r--r--src/services/updates.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/services/updates.ts b/src/services/updates.ts
index 06e86b1..dc82080 100644
--- a/src/services/updates.ts
+++ b/src/services/updates.ts
@@ -23,6 +23,7 @@ export interface Data {
cached?: boolean;
repos: Repo[];
errors: string[];
+ news: string;
}
@register({ GTypeName: "Updates" })
@@ -38,7 +39,7 @@ export default class Updates extends GObject.Object {
#timeout?: GLib.Source;
#loading = false;
- #data: Data = { cached: true, repos: [], errors: [] };
+ #data: Data = { cached: true, repos: [], errors: [], news: "" };
@property(Boolean)
get loading() {
@@ -60,11 +61,17 @@ export default class Updates extends GObject.Object {
return this.#data.repos.reduce((acc, repo) => acc + repo.updates.length, 0);
}
+ @property(String)
+ get news() {
+ return this.#data.news;
+ }
+
async #updateFromCache() {
this.#data = JSON.parse(await readFileAsync(this.#cachePath));
this.notify("update-data");
this.notify("list");
this.notify("num-updates");
+ this.notify("news");
}
async getRepo(repo: string) {
@@ -93,9 +100,9 @@ export default class Updates extends GObject.Object {
this.notify("loading");
// Get new updates
- Promise.allSettled([execAsync("checkupdates"), execAsync("yay -Qua")])
- .then(async ([pacman, yay]) => {
- const data: Data = { repos: [], errors: [] };
+ Promise.allSettled([execAsync("checkupdates"), execAsync("yay -Qua"), execAsync("yay -Pw")])
+ .then(async ([pacman, yay, news]) => {
+ const data: Data = { repos: [], errors: [], news: news.status === "fulfilled" ? news.value : "" };
// Pacman updates (checkupdates)
if (pacman.status === "fulfilled") {
@@ -145,6 +152,7 @@ export default class Updates extends GObject.Object {
this.notify("update-data");
this.notify("list");
this.notify("num-updates");
+ this.notify("news");
}
this.#loading = false;