Skip to content
Open
20 changes: 17 additions & 3 deletions system-updater/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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. |

Expand Down
9 changes: 9 additions & 0 deletions system-updater/adapters/gearlever/adapter.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
9 changes: 9 additions & 0 deletions system-updater/adapters/pipx/adapter.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
9 changes: 9 additions & 0 deletions system-updater/adapters/xbps/adapter.json
Original file line number Diff line number Diff line change
@@ -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": {}
}
14 changes: 14 additions & 0 deletions system-updater/adapters/xbps/check.bash
Original file line number Diff line number Diff line change
@@ -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 "]}"
25 changes: 23 additions & 2 deletions system-updater/plugin.toml
Original file line number Diff line number Diff line change
@@ -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.)."
Expand All @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions system-updater/service.luau
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions system-updater/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down