diff --git a/system-updater/README.md b/system-updater/README.md index c782b207..8b0eee23 100644 --- a/system-updater/README.md +++ b/system-updater/README.md @@ -1,10 +1,10 @@ # System Updates Manager -Manage system updates inside the noctalia panel. Currently supported PackageKit, Flatpak and Cargo. +Manage system updates inside the noctalia panel. Currently supported PackageKit, Flatpak, Cargo, pipx, Gear Lever, and XBPS. # Features -* Check updates with [PackageKit](https://www.freedesktop.org/software/PackageKit), [Flatpak](https://flatpak.org/) and Cargo. +* Check updates with [PackageKit](https://www.freedesktop.org/software/PackageKit), [Flatpak](https://flatpak.org/), [Cargo](https://doc.rust-lang.org/cargo/), [pipx](https://pipx.pypa.io/latest/index.html), [Gear Lever](https://gearlever.mijorus.it/), and [XBPS](https://github.com/void-linux/xbps). * Extensible with user created adapters * Support for offline updates with PackageKit * Single package update is supported @@ -43,6 +43,18 @@ Flatpak update adapter requires ```python``` and ```flatpak``` to be installed Cargo update adapter requires ```cargo```, ```python```, ```cargo-install-update```, `awk` and `bash` to be installed into ```$PATH```. +### pipx + +pipx update adapter requires ```pipx```, ```jq```, and ```grep``` to be installed into ```$PATH```. The adapter can update pipx itself if [your pipx installation is self-managed](https://pipx.pypa.io/latest/how-to/install-pipx.html#self-managed-pipx). + +### Gear Lever + +Gear Lever update adapter requires ```gearlever```, ```sed```, and ```coreutils``` (```echo```, ```tr```, ```head```) to be installed into ```$PATH```. + +### XBPS + +XBPS update adapter requires ```xbps``` (```xbps-install```, ```xbps-query```), ```jq```, ```bash```, ```grep```, and ```coreutils``` (```echo```, ```cut```) to be installed into ```$PATH```. + ## Usage Add the system-updater widget from Noctalia's widget picker, then click it to open the panel. You can also open the panel directly or bind it in your compositor: @@ -66,10 +78,12 @@ noctalia msg panel-toggle tordex/system-updater:panel | `enable_packagekit` | `bool` | `true` | Enable the PackageKit adapter for managing system updates. | | `enable_flatpak` | `bool` | `true` | Enable the Flatpak adapter for managing system updates. | | `enable_cargo` | `bool` | `true` | Enable the Cargo adapter for managing system updates. | +| `enable_pipx` | `bool` | `true` | Enable the pipx adapter for managing system updates. | +| `enable_gearlever` | `bool` | `true` | Enable the Gear Lever adapter for managing system updates. | +| `enable_xbps` | `bool` | `true` | Enable the XBPS adapter for managing system updates. | | `auto_check_minutes` | `int` | `60` | Check for updates automatically every N minutes. if <= 10 never checks on its own — nothing runs until you ask for it. | | `adapters_folder` | `folder` | | The folder where adapters definitions are stored. One adapter per subfolder. Each adapter folder must contain an adapter.json with the adapter definition. | | `notify_on_updates` | `bool` | `true` | Send a desktop notification when a check finds packages to upgrade or after applying updates. | -| `notify_on_updates` | `bool` | `true` | Send a desktop notification when a check finds packages to upgrade or after applying updates. | | `glyph` | `glyph` | `package` | The glyph shown for the system updater widget on the bar. | | `show_count` | `bool` | `true` | Show the number of pending updates next to the bar glyph. | diff --git a/system-updater/adapters/gearlever/adapter.json b/system-updater/adapters/gearlever/adapter.json new file mode 100644 index 00000000..eda33ecd --- /dev/null +++ b/system-updater/adapters/gearlever/adapter.json @@ -0,0 +1,9 @@ +{ + "name": "Gear Lever", + "enabled": true, + "dependencies": ["gearlever", "sed", "echo", "tr", "head"], + "check_command": "echo '{\"updates\":[' ; gearlever --list-updates 2>/dev/null | sed -r 's/\\//:/g' | sed -r 's/(([^ ]+ ?)*[^ ]+) +\\[.*\\] +([^ ]*)/{\"id\":\"\\3\",\"name\":\"\\1\",\"glyph\":\"settings-down\",\"from_version\":\"??\",\"to_version\":\"???\",\"description\":\"\",\"icon\":\"\"}/' | tr '\\n' ',' | head -c -1 ; echo ']}'", + "update_package_command": "gearlever --update --yes \"$(echo \"{package_name}\" | sed -r 's/:/\\//g')\"", + "update_all_command": "gearlever --update --all --yes", + "actions": {} +} \ No newline at end of file diff --git a/system-updater/adapters/pipx/adapter.json b/system-updater/adapters/pipx/adapter.json new file mode 100644 index 00000000..5b8601b6 --- /dev/null +++ b/system-updater/adapters/pipx/adapter.json @@ -0,0 +1,9 @@ +{ + "name": "pipx", + "enabled": true, + "dependencies": ["pipx", "jq", "grep"], + "check_command": "pipx list --json --outdated | grep -v \"Error\" | jq '.data | {\"info\": \"\", \"updates\": .packages | map({\"id\": .environment, \"name\": .package, \"from_version\": .version, \"to_version\": .latest_version, \"description\": \"\", \"icon\": \"\", \"glyph\": \"brand-python\"})}'", + "update_package_command": "pipx upgrade \"{package_name}\"", + "update_all_command": "pipx upgrade-all", + "actions": {} +} \ No newline at end of file diff --git a/system-updater/adapters/xbps/adapter.json b/system-updater/adapters/xbps/adapter.json new file mode 100644 index 00000000..fb7571d3 --- /dev/null +++ b/system-updater/adapters/xbps/adapter.json @@ -0,0 +1,9 @@ +{ + "name": "XBPS", + "enabled": true, + "dependencies": ["xbps-install", "xbps-query", "jq", "grep", "bash", "echo", "cut"], + "check_command": "{adapter_dir}/check.bash", + "update_package_command": "pkexec xbps-install -Suy \"{package_name}\"", + "update_all_command": "pkexec xbps-install -Suy", + "actions": {} +} \ No newline at end of file diff --git a/system-updater/adapters/xbps/check.bash b/system-updater/adapters/xbps/check.bash new file mode 100644 index 00000000..236f66cf --- /dev/null +++ b/system-updater/adapters/xbps/check.bash @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +PACKAGES=$(xbps-install -Mnu | jq -Rr '. | match("(.*?)-([^-]*?) ").captures | map(.string) | join("|")') +PREFIX="" +echo '{"updates":[' +for PACKAGE in $PACKAGES +do + echo $PREFIX + PREFIX="," + PACKAGE_NAME=$(echo $PACKAGE | cut -d '|' -f1) + PACKAGE_NEW_VERSION=$(echo $PACKAGE | cut -d '|' -f2) + PACKAGE_CURRENT_VERSION=$(xbps-query "$PACKAGE_NAME" | grep 'pkgver:' | jq -Rr '.| match("pkgver: (.*?)-([^-]*?)$").captures[1].string') + echo {\"id\": \"$PACKAGE_NAME\"", \"name\": \"$PACKAGE_NAME\", \"from_version\": \"$PACKAGE_CURRENT_VERSION\", \"to_version\": \"$PACKAGE_NEW_VERSION\", \"description\": \"\", \"icon\": \"\", \"glyph\": \"brand-node\"}" +done +echo "]}" \ No newline at end of file diff --git a/system-updater/plugin.toml b/system-updater/plugin.toml index dadf911d..35eca42b 100644 --- a/system-updater/plugin.toml +++ b/system-updater/plugin.toml @@ -1,10 +1,10 @@ id = "tordex/system-updater" name = "System Updates Manager" -version = "1.0.0" +version = "1.1.0" plugin_api = 20 author = "tordex" license = "MIT" -dependencies = ["pkgcli", "cargo", "cargo-install-update", "python", "flatpak", "awk", "bash"] +dependencies = ["pkgcli", "cargo", "cargo-install-update", "python", "flatpak", "awk", "bash", "jq", "grep", "coreutils", "sed"] tags = ["bar", "panel", "service", "system"] icon = "package" description = "Manage system updates (PackageKit, Flatpak, Cargo etc.)." @@ -30,6 +30,27 @@ label_key = "settings.enable_cargo.label" description_key = "settings.enable_cargo.description" default = true +[[setting]] +key = "enable_pipx" +type = "bool" +label_key = "settings.enable_pipx.label" +description_key = "settings.enable_pipx.description" +default = true + +[[setting]] +key = "enable_gearlever" +type = "bool" +label_key = "settings.enable_gearlever.label" +description_key = "settings.enable_gearlever.description" +default = true + +[[setting]] +key = "enable_xbps" +type = "bool" +label_key = "settings.enable_xbps.label" +description_key = "settings.enable_xbps.description" +default = true + [[setting]] key = "auto_check_minutes" type = "int" diff --git a/system-updater/service.luau b/system-updater/service.luau index 80844698..d05e1295 100644 --- a/system-updater/service.luau +++ b/system-updater/service.luau @@ -89,6 +89,12 @@ local function load_adapters() adapter.enabled = false elseif adapter.name == "Cargo" and cfg("enable_cargo") == false then adapter.enabled = false + if adapter.name == "pipx" and cfg("enable_pipx") == false then + adapter.enabled = false + elseif adapter.name == "Gear LEver" and cfg("enable_gearlever") == false then + adapter.enabled = false + elseif adapter.name == "XBPS" and cfg("enable_xbps") == false then + adapter.enabled = false end for _, dep in ipairs(adapter.dependencies or {}) do diff --git a/system-updater/translations/en.json b/system-updater/translations/en.json index fa703729..0628a3eb 100644 --- a/system-updater/translations/en.json +++ b/system-updater/translations/en.json @@ -50,6 +50,18 @@ "description": "Enable the PackageKit adapter for managing system updates.", "label": "Enable PackageKit adapter" }, + "enable_pipx": { + "description": "Enable the pipx adapter for managing Python application updates.", + "label": "Enable pipx adapter" + }, + "enable_gearlever": { + "description": "Enable the Gear Lever adapter for managing AppImage updates.", + "label": "Enable Gear Lever adapter" + }, + "enable_xbps": { + "description": "Enable the XBPS adapter for managing system updates.", + "label": "Enable XBPS adapter" + }, "glyph": { "description": "The glyph shown for the system updater widget on the bar.", "label": "Bar glyph"