# PacManager πŸ“¦ Package manager for **Arch Linux** based on **pacman**, with a Qt6 graphical interface. ## Features - πŸ” **Package search** - πŸ“¦ **Package installation** - πŸ—‘οΈ **Package removal** - πŸ”„ **Individual or global updates** - 🧹 **Cleanup**: orphan and legacy packages, cache trimming - πŸ“‹ **History of all actions** - 🧩 **Plugins**: package managers (pacman built-in, **Flatpak shipped by default**) and **extensions** written in C++ (UI addons, helpers, …) - πŸ“₯ **Flatpak files**: drop a `.flatpakref`, `.flatpakrepo` or `.flatpak` onto the window (or right-click β†’ **Open with PacManager** in your file manager) to install it directly β€” with the bytes actually downloaded and the elapsed time shown live, since flatpak prints nothing while a runtime comes down - πŸ” **Several installations**: an application installed per-user *and* system-wide, or from two remotes, stays a **single row**; the details panel lists the copies and **Remove** opens one checkbox per installation so the user picks the ones to get rid of - βš™οΈ **Settings**: when the admin password is asked, **where** the journal is written and how large it may grow, drag & drop of Flatpak files on or off, the interface language, and PacManager's own update policy (automatic check, block for 1 h / 24 h / 7 days / until cancelled) - ⌨️ **Command line**: `pacmanager search vlc` then `pacmanager install vlc` β€” the same logic as the window, without a screen (see [doc/cli.md](doc/cli.md)) ## Command line The same logic as the window can be used without opening an interface: ```bash pacmanager search vlc pacmanager install vlc pacmanager updates ``` Commands: `search`, `install`, `remove`, `update`, `list`, `updates`, `info`, `refresh`, `cleanup`, `help`, `version` (French keywords accepted too). `-y` / `--yes` skips confirmations, `--help` prints the help. The details are in [doc/cli.md](doc/cli.md). ## Architecture The code is split in two layers, and the split is structural: **every rule lives in `AppCore`**, every screen lives in `pages/` β€” the Qt window (`MainWindow`) is only the frame around them. - `core/app-core.h` + `core/app-core.cpp` β€” **the logic**: providers (pacman, Flatpak, AUR…), worker threads, history, plugin registry, privileged commands (`sudo`), pacman's database lock, self-update. No widget at all: the layer depends on Qt Core only and runs headless (`build/app-core-test` does not even link QtWidgets). - `app/main-window.h` + `app/main-window.cpp` β€” **the frame**: sidebar, header, status bar, menus, tray, dialogs (sudo password, pacman lock, export) and the stack holding the screens. No business rule. - `pages/` β€” **the screens, one file per screen**: `dashboard-page`, `browse-page` (search / installed / updates), `cleanup-page`, `history-page`, `logs-page`, `plugins-page`. `page.h` holds the shared contract (`navTitle()`, `refresh()`, asking the frame for an operation) and `ui-kit.*` the shared widgets (tables, cards, badges). Reworking a UI means editing its file under `pages/`; adding a screen means one `Page` subclass plus a sidebar entry β€” nothing else. The conversation always goes the same way: the view calls a core method (`install()`, `loadUpdates()`, `cleanCaches()`…), which answers "started", "I need the sudo password" or "pacman's database is locked"; the view then asks the user for whatever is missing and replays the request. Results come back as signals (`listFinished`, `actionProgress`, `actionFinished`, `statusMessage`…). Every operation that spawns a process is asynchronous. ``` PacManager/ β”œβ”€β”€ CMakeLists.txt # app, plugins and tests targets β”œβ”€β”€ app/ # FRAME: the window and the entry point β”‚ β”œβ”€β”€ main.cpp # entry point: journal, language, window, CLI β”‚ └── main-window.h/.cpp # sidebar, menus, dialogs, stylesheet β”œβ”€β”€ cli/ # COMMAND LINE (no widget) β”‚ β”œβ”€β”€ cli-command.h/.cpp # accepted grammar (tested) β”‚ └── cli-application.h/.cpp # execution on AppCore β”œβ”€β”€ core/ # LOGIC: everything the app does β”‚ β”œβ”€β”€ app-core.h/.cpp # the controller the screens delegate to β”‚ β”œβ”€β”€ workers.h/.cpp # worker threads (search, listings, actions) β”‚ └── package-model.h/.cpp # Qt model for the lists β”œβ”€β”€ providers/ # package providers β”‚ β”œβ”€β”€ pacman-manager.h/.cpp # pacman, built-in β”‚ β”œβ”€β”€ flatpak-provider/ # Flatpak provider β”‚ β”œβ”€β”€ aur-provider/ # AUR provider (yay/paru) β”‚ β”œβ”€β”€ example-provider/ # provider template β”‚ └── example-addon/ # extension template β”œβ”€β”€ plugins/ # plugin host β”‚ β”œβ”€β”€ plugin-manager.h/.cpp # registry + shared-library loading β”‚ └── plugin-package.h/.cpp # installing a .fwspacm package β”œβ”€β”€ preferences/ # what the user chose β”‚ β”œβ”€β”€ app-settings.h/.cpp # the settings model β”‚ └── language-manager.h/.cpp # interface and journal language β”œβ”€β”€ logging/ # the journal β”‚ β”œβ”€β”€ log-manager.h/.cpp # operations.log, read by the Logs screen β”‚ └── app-logging.h/.cpp # qCDebug/qCInfo categories β”œβ”€β”€ history/ # action history (CSV) β”œβ”€β”€ update/ # PacManager self-update β”œβ”€β”€ archive/ # minimal ZIP reader (zlib), for .fwspacm β”œβ”€β”€ include/sdk/ # public plugin SDK (installed flat) β”‚ β”œβ”€β”€ package-manager.h # IPackageManager interface + merge helpers β”‚ β”œβ”€β”€ plugin.h # generic plugin contract (IPlugin) β”‚ β”œβ”€β”€ provider-plugin.h # C ABI contract for external plugins β”‚ β”œβ”€β”€ progress-tracker.h # progress read from the tools' output β”‚ └── provider-trace.h # provider trace, journal only β”œβ”€β”€ pages/ # INTERFACE: one file per screen β”‚ β”œβ”€β”€ base/ # screen contract + shared widgets β”‚ β”œβ”€β”€ packages/ # search, installed, updates, cleanup β”‚ β”œβ”€β”€ overview/ # dashboard, history β”‚ β”œβ”€β”€ system/ # logs, settings β”‚ └── extensions/ # plugins β”œβ”€β”€ translations/ # catalogues, one JSON per language (French is the source) β”œβ”€β”€ doc/ # this documentation (source of the wiki) β”œβ”€β”€ tests/ # unit and integration tests └── resources/ # icons and catalogues compiled into the binary ``` ## Compilation (Arch Linux) ### Dependencies ```bash sudo pacman -S qt6-base cmake gcc base-devel ``` ### Build ```bash cd FWS-PacManage # Configure and compile cmake -B build -DFWS_BUILD_EXAMPLE_PLUGIN=ON cmake --build build -j$(nproc) ``` The **Flatpak plugin is built by default** (`FWS_BUILD_FLATPAK_PLUGIN=ON`): a plain `cmake -B build` is enough to get a Flatpak-enabled app. Useful options: - `-DFWS_BUILD_FLATPAK_PLUGIN=OFF`: skip the Flatpak plugin; - `-DFWS_BUILD_EXAMPLE_ADDON=ON`: also build the example addon plugin (`build/plugins/libsample-addon.so`). ### Install **User install** (recommended, no sudo β€” the binary goes to `~/.local/bin`): ```bash cmake --install build --prefix ~/.local # To run `PacManager` from a terminal (optional): echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # then restart your shell ``` **System install** (root, into `/usr/local/bin`): ```bash sudo cmake --install build ``` ### Show up in the app launcher (a real app, no command) To make PacManager appear in the launcher of any desktop (wofi, GNOME, KDE...), like a pacman install: ```bash mkdir -p ~/.local/share/applications ~/.local/share/icons/hicolor/scalable/apps cp resources/icons/package.svg ~/.local/share/icons/hicolor/scalable/apps/org.fws.PacManager.svg cat > ~/.local/share/applications/org.fws.PacManager.desktop < ⚠️ **Updating from a version older than 1.5.0**: installing the build > dependencies automatically only exists from **1.5.0** on. A **1.4.3 or older** > build recompiles with whatever it finds: if `cmake`, `gcc`/`base-devel`, `git` > or `qt6-base` are missing, the update fails β€” or is not even offered (method > "None", releases page). Install them first: > > ```bash > sudo pacman -S --needed base-devel cmake gcc git qt6-base > ``` > > Once on 1.5.0, PacManager handles it itself as soon as the sudo password is > entered. Full detail: [doc/mise-a-jour.md](doc/mise-a-jour.md). Everything builds in a temporary directory: `sudo` is only used for the final binary replacement (when the target directory is root-owned) and for **automatically installing the build dependencies** β€” when `qt6-base`, `cmake`, `gcc`/`base-devel` or `git` are missing, PacManager installs them itself through `pacman` as soon as the sudo password is entered, then resumes the build. PacManager then restarts automatically on the new version. Nothing produces a prebuilt archive automatically: without one attached to the release, **Clone** or **Tarball** applies instead β€” having `pacman` and the sudo password is enough, the rest is installed by the update itself. All four methods install to the same place β€” the running binary's directory β€” and rewrite the `version` file there. To know which release is really installed, PacManager keeps the **newest** of two sources: the version compiled into the binary (read from the repo's `version` file at configure time) and the one in the `version` file next to the executable. An applied update is therefore never offered again, even when one of the two lags behind (a binary rebuilt without configuring again, an install older than the binary). ## Graphical interface The interface uses **Qt6** with a dark theme, a **navigation sidebar** and stacked pages: - 🏠 **Dashboard**: statistics cards, quick actions and recent activity - πŸ” **Search**: search bar, package table on the left and details on the right - πŸ“¦ **Installed**: list with **instant name filter** (local, no pacman re-run) - ⬆️ **Updates**: outdated packages detected by `pacman -Qu`, **the check runs as soon as the tab opens** (no need to press "Update all" to see the list), "Update all" button - 🧹 **Cleanup**: **orphan** packages (`pacman -Qdt`, nothing requires them) and **legacy** ones (`pacman -Qm`, AUR / manual builds), bulk removal of the orphans, and cache trimming: `paccache` / `pacman -Sc` and unused Flatpak runtimes (`flatpak uninstall --unused`) - πŸ“‹ **History**: filterable table (installs / removals / updates / cleanups) + CSV export - πŸ“œ **Logs**: the application journal (`operations.log`: operations, command output, provider trace) **and** `/var/log/pacman.log`, selectable, with an instant filter - 🧩 **Plugins**: lists every plugin (package providers and extensions), enable / disable and plugin rescan - ⌨️ **Convenience**: system tray icon and keyboard shortcuts (Ctrl+F search, Ctrl+R / F5 refresh, Ctrl+U updates, Ctrl+E export, Ctrl+Q quit) - πŸ”’ **pacman lock**: when another manager (pamac, octopi, yay…) holds the database, PacManager names it (process + PID) and offers to close it and resume the operation, instead of waiting for it to finish; a leftover lock is removed the same way - 🎨 **Legibility**: a sidebar split into sections, showing the installed version and the pending update count; quick actions (refresh, update all) in the header, reachable from any page; empty lists that say what to do next - πŸ“€ **Export**: the displayed package list and the history can be exported as CSV ### Interface overview ```text β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ File Tools Help β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ πŸ“¦ PacManager β”‚ Search β”‚ β”‚ β”‚ Find and install packages β”‚ β”‚ 🏠 Dashboard β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ πŸ” Search β”‚ β”‚ πŸ” Search for a package (e.g. firefox)... β”‚ β”‚ Search β”‚ β”‚ β”‚ πŸ“¦ Installed β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”‚ ⬆️ Updates β”‚ [+ Install] [- Remove] [^ Update] [^^ Update all] β”‚ β”‚ πŸ“‹ History β”‚ β”Œ Name β”‚ Version β”‚ Repo β”‚ Status ┐ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ β”‚ πŸ“œ Logs β”‚ β”‚ firefox β”‚ 128.0 β”‚ extra β”‚ βœ… Installed β”‚ β”‚ firefox β”‚ β”‚ β”‚ β”‚ β”‚ vlc β”‚ 3.0.21 β”‚ extra β”‚ βœ… Installed β”‚ β”‚ Version: 128.0 β”‚ β”‚ β”‚ β”‚ β”‚ ... β”‚ β”‚ β”‚ β”‚ β”‚ [extra] [289 MB] β”‚ β”‚ β”‚ β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ β”‚ πŸ”„ Refresh β”‚ β”‚ Fast and secure β”‚ β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚ pacman 1.0.0 | Packages shown: 6 | History entries: 12 β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` ## Plugins & extensions Two kinds of plugins coexist, both written in **C++**: - **Providers** (`IPackageManager`): add a package manager (pacman built-in, Flatpak external, apt, dnf, …); - **Extensions / addons** (`IPlugin`): anything else β€” a UI addon, a helper, a better loading experience… β€” with no relation to package management. ### Installing a plugin: a `.fwspacm` file There is no shop. A plugin is distributed as a **`.fwspacm` package** β€” a ZIP archive holding a `plugin.json` manifest and the shared library β€” that the user **drops onto the window**. No catalogue, no network, no button: the file *is* the distribution format. The script at the repo root builds a package from a compiled library: ```bash ./make-plugin-package.py build/libsample-provider.so \ --id sample-provider --name "My provider" --version 1.0.0 ``` The manifest format, the security rules and troubleshooting are in [doc/paquets-de-plugin.md](doc/paquets-de-plugin.md) (written in French, like the rest of `doc/`). The `IPackageManager` interface (implemented by the built-in `PacmanManager` and the Flatpak plugin) defines: | Method | Description | |--------|-------------| | `getName()` | Manager name | | `getVersion()` | Manager version | | `getDescription()` | Description | | `canSearch()` | Supports search | | `canInstall()` | Supports installation | | `canRemove()` | Supports removal | | `canUpdate()` | Supports updates | | `canListInstalled()` | Supports listing installed packages | | `isAvailable()` | Checks whether the tool is installed | | `requiresPassword()` | True when operations go through sudo (pacman) | | `search(query)` | Search for packages | | `install(name, callback)` | Installation | | `remove(name, callback)` | Removal | | `update(name, callback)` | Update | | `listInstalled()` | List installed packages | | `listUpdates()` | List outdated packages | | `refresh(callback)` | Refresh the sources | | `canListCleanup()` | Can list the packages a cleanup may reclaim | | `listCleanupCandidates()` | Orphan (`orphan`) and legacy packages, with their reason | | `removePackages(names, callback)` | Removes several packages in a single command | | `canCleanCache()` / `cleanCache(callback)` | Trims the provider's cache (pacman cache, unused Flatpak runtimes) | The last four methods are **optional**: a provider that only installs packages implements nothing, and the Cleanup page then simply reports that it has nothing to offer. Search queries **all active providers at once**: every result shows its origin in the **Provider** column (Pacman, Flatpak, …), and the Installed / Updates pages are aggregated. Install, remove and update are routed automatically to the right manager. The sidebar **Plugins** page lists everything (providers **and** addons), lets you enable / disable each plugin, rescan plugins and **install a missing tool** (e.g. "Install tool" for Flatpak runs `sudo pacman -S flatpak`, then the provider becomes available). ### Adding a plugin **Pacman** is **built-in** (compiled into the application); **Flatpak** is an **external plugin** loaded at runtime from `plugins/` (source in `providers/flatpak-provider`), next to the executable or in `~/.local/share/PacManager/plugins/`, and **built by default** (`FWS_BUILD_FLATPAK_PLUGIN=ON`). Flatpak installs auto-add the flathub remote when missing and fall back to a **per-user** install (no password) when the system-wide install fails (polkit, homonymous remotes) β€” the real error is shown on failure. An app installed via Flatpak appears immediately in the desktop launcher: its `.desktop` entries and icons are linked into `~/.local/share/applications` and `~/.local/share/icons` (the XDG dirs scanned by **every** environment: wofi, GNOME, KDE…), exactly like a pacman install, and are removed again on uninstall. Search shows the real status of each app (Installed / Update available). A **Flatpak file** can also be installed directly, without going through search: drop it on the window or pick **Open with PacManager** in the file manager (`.flatpakref` and `.flatpak` start an install, `.flatpakrepo` registers the remote under the file's name). This is covered by an **integration test** that drives the real flatpak CLI (install, list, update, search, uninstall). **Adding a provider** (apt, dnf, zypper, or another distro's repos) without touching the application: 1. Implement `IPackageManager` in a `.cpp` file (copy `providers/example-provider/example-provider.cpp` as a template). 2. Export the C ABI contract with the `FWS_PROVIDER_PLUGIN(MyManager, "id", "Name", "1.0.0", "Description", "Author")` macro. 3. Compile it as a shared library and drop it into `~/.local/share/PacManager/plugins/` or `plugins/` next to the executable. 4. Click **Rescan** on the Plugins page. **Adding an extension / addon** (anything, as long as it is C++): 1. Implement `IPlugin` in a `.cpp` file (copy `providers/example-addon/example-addon.cpp` as a template). The `onLoad()` / `onUnload()` lifecycle hooks are called by the application, and `onUiReady(QMainWindow*)` hands you the main window to attach your own widgets (status bar, buttons, …). 2. Export the C ABI contract with the `FWS_ADDON_PLUGIN(MyAddon, "id", "Name", "1.0.0", "Description", "Author")` macro. 3. Compile it as a shared library and drop it into `~/.local/share/PacManager/plugins/` or `plugins/` next to the executable. 4. Click **Rescan** on the Plugins page. Building the example plugins: ```bash cmake -B build -DFWS_BUILD_EXAMPLE_PLUGIN=ON -DFWS_BUILD_EXAMPLE_ADDON=ON && cmake --build build # build/plugins/libsample-provider.so and build/plugins/libsample-addon.so are copied next to the executable ``` The plugin must be compiled with the same compiler and headers as the application (like a regular Qt plugin). ## Development & conventions This project follows the **FWS** organisation conventions, detailed in [`CONTRIBUTING.md`](CONTRIBUTING.md) / [`CONTRIBUTING.en.md`](CONTRIBUTING.en.md): - **Branches**: `type/description` (e.g. `feat/login`, `fix/typo`). - **Commits**: message in **English**, **Conventional Commits** format `(): `. Allowed types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`. Short, imperative title; the body explains only the **why**; commits are **signed**, with no tool mention and no automatic co-author. - **Naming**: `kebab-case` files; identifiers (variables, functions, classes) in **English**. - **Code & comments**: in **English**, "why" style (document the non-obvious β€” design choices, trade-offs β€” not the trivial). - **Tests**: `*.test.*` files with `describe` / `it` names in English; run tests (and typecheck / lint when present) before considering a task done. Run them with `ctest` from `build/`. - **Issues & bugs**: tracked through **issues** linked to the **Kanban** board; any PR fixing a bug references the issue (`Fixes #123`); do not close or modify an issue without explicit request. - **Sensitive files (`.gitignore`)**: never commit `.env*`, `.freebuff/`, `build/` / `dist/` / `target/` / `__pycache__/`, `node_modules/`, secrets. A `.gitignore` exists at the repo root. To build, test and propose a change, see [`CONTRIBUTING.en.md`](CONTRIBUTING.en.md). ## License **Proprietary β€” source available, personal use only.** The code in this repository **may be improved and modified for your own personal use**, but it is **strictly forbidden to distribute or sell it**, in whole or in part, modified or not. See the [`LICENSE`](LICENSE) file for the full terms. Summary: - βœ… modify and improve the code for your **own personal use**; - ❌ **distribute** or **share** the code, modified or not, with anyone; - ❌ **sell**, lease, monetize or reuse the code in a commercial product; - ❌ include the code in another project, hosted service or SaaS.