Files
FWS-PacManage/README.en.md
T
BlackAngelTV ecf38c61f6 docs: describe flatpak as an external plugin in the READMEs
Updates both READMEs so the architecture and providers sections reflect
that pacman is built-in while Flatpak ships as a runtime-loaded plugin.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-08-29 20:35:17 +02:00

213 lines
12 KiB
Markdown

# 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**
- 📋 **History of all actions**
- 🧩 **Multi-provider**: pacman and Flatpak built in, plus **plugins** to add other managers (apt, dnf, …)
## Architecture
```
package-manager/
├── CMakeLists.txt # Build root
├── include/
│ ├── package-manager.h # Package manager interface (IPackageManager)
│ ├── provider-plugin.h # C ABI contract for provider plugins
│ ├── pacman-manager.h # pacman manager (Arch Linux, built-in)
│ ├── plugin-manager.h # Provider registry + plugin loading
│ ├── main-window.h # Main GUI
│ ├── history-manager.h # Action history
│ └── package-model.h # Qt model for the list
├── src/
│ ├── main.cpp
│ ├── main-window.cpp
│ ├── pacman-manager.cpp
│ ├── flatpak-manager.cpp
│ ├── plugin-manager.cpp
│ ├── history-manager.cpp
│ └── package-model.cpp
├── plugins/
│ ├── example-provider/ # Example external plugin (template)
│ └── flatpak-provider/ # Flatpak plugin (loaded at runtime)
├── 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)
```
### 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 <<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
```bash
# 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
```
## 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
- 📋 **History**: filterable table (installs / removals / updates)
- 📜 **Logs**: built-in `/var/log/pacman.log` viewer
- 🧩 **Providers**: lists all managers (built-in and plugins), enable / disable and plugin rescan
### 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 │
└──────────────────────────────────────────────────────────────────────────────────────┘
```
## Package managers (providers)
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 |
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 **Providers** page lets you enable / disable each provider, 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 provider (plugins)
**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/`. 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). To add another manager (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 Providers page.
Building the example plugin:
```bash
cmake -B build -DFWS_BUILD_EXAMPLE_PLUGIN=ON && cmake --build build
# build/plugins/libsample-provider.so is 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`](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.