BlackAngelTV b204d6814a feat(update): install missing build dependencies before rebuilding
A minimal Arch system has no cmake, no compiler and no qt6-base, so the
self-update used to fail or fall back to the releases page. The update
now asks pacman what is missing, installs it through sudo with the
password typed in the update dialog, then resumes the build.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-09-23 21:58:21 +02:00
2026-09-11 20:11:50 +02:00

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, …)

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.

  • include/app-core.h + src/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).
  • include/main-window.h + src/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.

package-manager/
├── CMakeLists.txt              # Build root
├── include/
│   ├── app-core.h              # LOGIC: everything the app does (no widget)
│   ├── workers.h               # Shared threads (search / listings / actions)
│   ├── package-manager.h       # Package manager interface (IPackageManager)
│   ├── plugin.h                # Generic plugin contract (PluginInfo, IPlugin)
│   ├── provider-plugin.h       # C ABI contract for plugins (providers + addons)
│   ├── pacman-manager.h        # pacman manager (Arch Linux, built-in)
│   ├── plugin-manager.h        # Plugin registry + shared-library loading
│   ├── main-window.h           # INTERFACE: the window frame
│   ├── history-manager.h       # Action history
│   ├── package-model.h         # Qt model for the list
│   └── update-manager.h        # Self-update (releases)
├── src/
│   ├── main.cpp
│   ├── app-core.cpp
│   ├── workers.cpp
│   ├── main-window.cpp
│   ├── pacman-manager.cpp
│   ├── plugin-manager.cpp
│   ├── history-manager.cpp
│   ├── package-model.cpp
│   ├── update-manager.cpp
│   └── app-logging.cpp
├── pages/                      # INTERFACE: one file per screen
│   ├── page.h/.cpp             # Screen contract (Page) + helpers
│   ├── ui-kit.h/.cpp           # Shared widgets (tables, cards, badges)
│   ├── dashboard-page.h/.cpp   # Dashboard
│   ├── browse-page.h/.cpp      # Search / installed / updates
│   ├── cleanup-page.h/.cpp     # Cleanup
│   ├── history-page.h/.cpp     # History
│   ├── logs-page.h/.cpp        # pacman logs
│   └── plugins-page.h/.cpp     # Plugins
├── plugins/
│   ├── example-provider/        # Example external provider plugin (template)
│   ├── example-addon/           # Example external addon plugin (extension, template)
│   └── flatpak-provider/        # Flatpak plugin (loaded at runtime, built by default)
├── tests/                      # Unit tests (assert, no Qt)
└── resources/

Compilation (Arch Linux)

Dependencies

sudo pacman -S qt6-base cmake gcc base-devel

Build

cd package-manager

# 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):

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):

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:

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 <<EOF
[Desktop Entry]
Type=Application
Name=PacManager
GenericName=Package Manager
Comment=Package manager for Arch Linux
Exec=$HOME/.local/bin/PacManager
Icon=org.fws.PacManager
Terminal=false
Categories=System;Utility;Qt;
Keywords=package;pacman;flatpak;install;update;
StartupNotify=true
EOF
update-desktop-database ~/.local/share/applications

Run

# From the build directory
./build/PacManager

# From the app launcher (recommended): $mod+R (Hyprland) or your application menu, type "PacManager"

# From a terminal, after install + PATH
PacManager

Automatic update

At startup (then once a day), PacManager queries the repository's latest release and offers to update itself. The new binary is always written to the directory of the running executable, so the update follows the app wherever it is installed (~/.local/bin, /usr/bin, an extracted folder, a build tree…) without assuming any particular prefix.

The method is picked automatically (no configuration):

Method When What happens
Checkout a source checkout surrounds the binary (dev) git pull, rebuild, install into the binary's directory
Clone installed app with no checkout, and git + cmake + a compiler the repo is cloned/updated in ~/.local/share/PacManager/src, rebuilt and installed in place
Prebuilt no build toolchain available, and the release has a prebuilt archive attached that archive is downloaded and unpacked
Tarball no git, but cmake + a compiler the release sources are built and installed

Everything builds in a temporary directory: only the final replacement of the binary (and plugins) needs sudo, and only when the target directory is owned by root. 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 (so git, cmake and a compiler are needed on the machine).

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, "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: built-in /var/log/pacman.log viewer 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

┌──────────────────────────────────────────────────────────────────────────────────────┐
│ 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.

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/ (plugins/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). 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 plugins/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 plugins/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:

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 AGENTS.md:

  • Branches: type/description (e.g. feat/login, fix/typo).
  • Commits: message in English, Conventional Commits format <type>(<scope>): <description>. Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert. Short, imperative title; the body explains only the why.
  • 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.

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 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.
S
Description
Gestionnaire de paquet pour FWS
Readme
3.4 MiB
2 Stars 3 Watchers 0 Forks
V1.6.2
Latest
2026-10-30 18:28:24 +01:00
Languages
C++ 95.8%
CMake 2.8%
Python 0.8%
C 0.4%
Batchfile 0.2%