From 18921c6847829fcbe11834ef1fc1ad73a854b2f2 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Tue, 18 Mar 2025 13:41:37 +1100 Subject: updates: show updates for custom repos --- src/services/updates.ts | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'src/services/updates.ts') diff --git a/src/services/updates.ts b/src/services/updates.ts index 8477733..b58609b 100644 --- a/src/services/updates.ts +++ b/src/services/updates.ts @@ -92,6 +92,19 @@ export default class Updates extends GObject.Object { ); } + getRepoIcon(repo: string) { + switch (repo) { + case "core": + return "hub"; + case "extra": + return "add_circle"; + case "multilib": + return "account_tree"; + default: + return "deployed_code_update"; + } + } + getUpdates() { // Return if already getting updates if (this.#loading) return; @@ -106,21 +119,14 @@ export default class Updates extends GObject.Object { // Pacman updates (checkupdates) if (pacman.status === "fulfilled") { - const repos: Repo[] = [ - { repo: await this.getRepo("core"), updates: [], icon: "hub", name: "Core repository" }, - { - repo: await this.getRepo("extra"), - updates: [], - icon: "add_circle", - name: "Extra repository", - }, - { - repo: await this.getRepo("multilib"), + const repos: Repo[] = await Promise.all( + (await execAsync("pacman-conf -l")).split("\n").map(async r => ({ + repo: await this.getRepo(r), updates: [], - icon: "account_tree", - name: "Multilib repository", - }, - ]; + icon: this.getRepoIcon(r), + name: r[0].toUpperCase() + r.slice(1) + " repository", + })) + ); for (const update of pacman.value.split("\n")) { const pkg = update.split(" ")[0]; -- cgit v1.2.3-freya