# 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) ## 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 β”‚ β”œβ”€β”€ plugin-package.h # Installing a .fwspacm plugin package β”‚ β”œβ”€β”€ zip-archive.h # Minimal ZIP reader (zlib) β”‚ β”œβ”€β”€ 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) β”œβ”€β”€ make-plugin-package.py # Builds a .fwspacm package from a shared library β”œβ”€β”€ tests/ # Unit tests (assert, no Qt) └── resources/ ``` ## Compilation (Arch Linux) ### Dependencies ```bash sudo pacman -S qt6-base cmake gcc base-devel ``` ### Build ```bash 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`): ```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 <(): `. 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.