Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Pull requests and branch pushes: formatting, lints, tests, Nautilus extension.
# Jobs: Nautilus extension and packaging checks; native libraries (.NET NativeAOT + Rust, cached
# Pull requests and branch pushes: formatting, lints, tests, Nautilus extension, Dolphin plugins.
# Jobs: Nautilus extension and packaging checks; Dolphin plugins; native libraries (.NET NativeAOT + Rust, cached
# on the revisions pinned in scripts/build-native.sh); Rust formatting, lints and tests.
name: ci
on:
Expand All @@ -19,6 +19,21 @@ jobs:
- run: for f in po/*.po; do msgfmt --check -o /dev/null "$f"; done
- run: scripts/check-version.sh

# The Dolphin plugins need KDE Frameworks 6, which Ubuntu 24.04 does not have: Debian 13 container
# (6.13, the target of the DEB package; it provides KOverlayIconPlugin in KIOCore).
dolphin-plugin:
runs-on: ubuntu-24.04
container: docker.io/library/debian:trixie
steps:
- run: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates git g++ make cmake extra-cmake-modules \
libkf6kio-dev libkf6coreaddons-dev libkf6i18n-dev qt6-base-dev
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- run: cmake -S integrations/dolphin -B build-dolphin -DCMAKE_BUILD_TYPE=Release
- run: cmake --build build-dolphin
- run: ls -l build-dolphin/bin/kf6/overlayicon/pdriveoverlay.so build-dolphin/bin/kf6/kfileitemaction/pdriveactions.so

# The two native libraries the Rust crates link against. A cache hit (same pinned revisions,
# runner image and .NET major version) skips the .NET build, which takes several minutes.
native:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
/third_party/
/native/linux-x64/
/extension/*.so
/integrations/dolphin/build/
/dist/
/.superset/config.local.json
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ Choix techniques (tranchés le 28/10/2026) :
- **Connexion :** sans session, l'application ne lance pas le daemon et sa fenêtre propose « Se connecter », qui exécute `pdrive login` (mention « application tierce non officielle » affichée dans la fenêtre), puis lance le daemon. « Se déconnecter » arrête le daemon puis exécute `pdrive logout`.
- **Icône :** dossier violet, à dessiner en SVG sans reprendre le logo Proton. Variantes : synchronisé, en cours de synchronisation, erreur, déconnecté. Elles sont installées dans le thème `hicolor` et transmises par nom (`IconName`) ; pas de repli en pixmap pour l'instant.

### Intégration à Dolphin et à COSMIC Files (13/11/2026)

Plan : ajouter Dolphin (KDE) et COSMIC Files à Nautilus, sans changer le daemon (l'API D-Bus `io.github.bpresles.PDrive1` suffisait) ni le bouton « Ouvrir le dossier » (il suit `mimeapps.list` via GIO). Un seul paquet contient l'extension Nautilus et les plugins Dolphin, sans dépendance vers KF6, Qt6 ni `libnautilus-extension` (une machine peut avoir plusieurs environnements) ; `Recommends: nautilus` est retiré, `Suggests: nautilus, dolphin` ajouté.

- [x] CLI `pdrive keep-offline PATH...` et `pdrive free-up-space PATH...` (`crates/pdrive/src/offline.rs`) : chemins hors du montage ignorés, notification de bureau et code 1 si aucun n'est dans le drive ou si le daemon est absent ; page de manuel mise à jour.
- [x] `crates/pdrive-app/src/integrations.rs`, appelé au démarrage et au changement de point de montage, selon les gestionnaires **installés** (jamais selon la session) : signet « Proton Drive » dans `user-places.xbel` (fichier existant seulement, marqueur `<ID>pdrive-for-linux</ID>`), favori et actions `context_actions` de COSMIC Files (RON édité comme du texte, entrées reconnues par leur commande `pdrive`). Écriture atomique, idempotente, limitée à nos entrées. Réglage `file_manager_integration` (actif par défaut, interrupteur dans les réglages, clé acceptée par le parseur strict du daemon), option `pdrive-app --remove-integrations` (appelée par `scripts/uninstall.sh`). Tests unitaires sur des chaînes et des dossiers temporaires.
- [x] Plugins Dolphin C++ / KF6 (`integrations/dolphin/`) : `pdriveoverlay` (`KOverlayIconPlugin`, emblèmes, cache borné, appels D-Bus asynchrones) et `pdriveactions` (`KAbstractFileItemActionPlugin`, menus limités aux fichiers du drive). Textes du domaine gettext `pdrive` par `i18nd` ; `scripts/update-po.sh` extrait `i18nd`.
- [x] Paquets : spec RPM (`__requires_exclude_from`), `debian/` (`dh_shlibdeps -X`, plus de `libnautilus-extension4` en `Depends`), PKGBUILD (`optdepends` `nautilus` et `dolphin`), `scripts/install-system.sh` (construit ce qui est détecté) et `uninstall.sh`, scripts de conteneur, job CI `dolphin-plugin` (Debian 13), README, `packaging/README.md`, pages de manuel.
- Limites : pas d'emblèmes dans COSMIC Files (aucune API d'extension) et ses deux actions apparaissent sur tous les fichiers ; Nemo, Thunar et Caja non traités ; les paquets ne nettoient pas les fichiers de configuration de l'utilisateur à la désinstallation.
- [ ] À tester à la main : COSMIC (favori, actions, notification hors drive, interrupteur), session KDE réelle (emblèmes, menus, entrée dans Emplacements, pas de second volume dans « Périphériques », icônes `emblem-pdrive-*` avec le thème Breeze), changement d'environnement sans réinstaller, installation du paquet sur une machine GNOME seule (ni KF6 ni Qt6 tirés).

## 3. Autres pistes (backlog)

- [ ] Fichiers « Partagés avec moi » (SDK : `EnumerateSharedWithMeNodeUids`), sous un sous-dossier dédié.
Expand Down
99 changes: 82 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
> Drive SDK and does not reuse any Proton logo.

PDrive for Linux gives Proton Drive a place in the Linux desktop: your "My files" folder is
mounted at `~/ProtonDrive`, files are downloaded when you open them, and Nautilus (GNOME Files)
shows their sync state, with a sidebar entry and a context menu.
mounted at `~/ProtonDrive`, files are downloaded when you open them, and the file managers show
it: Nautilus (GNOME Files) and Dolphin (KDE) show the sync state with a context menu, Dolphin and
COSMIC Files list the drive in their sidebar (see [File managers](#file-managers)).

Status: early alpha (the application identifies itself to Proton with the `-alpha` channel).

Expand All @@ -32,6 +33,10 @@ Status: early alpha (the application identifies itself to Proton with the `-alph
files are dropped first, pinned files are kept).
- **Nautilus extension**: sync state emblems, and the context menu entries "Keep Available
Offline" and "Free Up Space". Open windows are reloaded when the drive is mounted.
- **Dolphin plugins** (KDE Frameworks 6): the same emblems and context menu entries, plus a
"Proton Drive" entry in the places panel.
- **COSMIC Files**: a favorite and two context menu actions ("PDrive: Keep Available Offline",
"PDrive: Free Up Space"). No emblems: COSMIC Files has no extension API.
- **Sidebar entry** through libcloudproviders, with a menu (show status, open in the browser,
mount / unmount).
- **Desktop application** (`pdrive-app`): tray icon, status window (account, used space,
Expand All @@ -45,7 +50,8 @@ Status: early alpha (the application identifies itself to Proton with the `-alph
on Fedora, already installed on Ubuntu); otherwise the status window is shown with an
explanation.
- **Translations** with gettext (French first, see `po/`).
- **Command-line tool** `pdrive`: `login`, `logout`, `status`, `ls [PATH]`, `selftest`.
- **Command-line tool** `pdrive`: `login`, `logout`, `status`, `ls [PATH]`, `keep-offline PATH...`,
`free-up-space PATH...`, `selftest`.

The session is kept in the Secret Service keyring (oo7, GNOME Keyring, KWallet, ...). The
sign-in goes through your browser: PDrive never sees your password. When Proton no longer
Expand Down Expand Up @@ -109,8 +115,12 @@ flowchart LR
`packaging/io.github.bpresles.PDrive.ini`.
- **`pdrive-app`** (GTK4 / libadwaita, application id `io.github.bpresles.PDrive.App`) runs and
watches the daemon and shows its state. The daemon stops when the application dies.
- **The Nautilus extension** (`extension/`) asks the daemon over D-Bus for the state of the
files it displays.
- **The Nautilus extension** (`extension/`, C) and **the Dolphin plugins**
(`integrations/dolphin/`, C++ / KDE Frameworks 6) ask the daemon over D-Bus for the state of
the files they display. Nothing in the daemon is specific to a file manager.
- **`pdrive-app`** also writes the sidebar entries and menu actions of Dolphin and COSMIC Files in
the configuration of the user (`crates/pdrive-app/src/integrations.rs`); COSMIC Files runs
`pdrive keep-offline` / `pdrive free-up-space`.

## Installation

Expand All @@ -130,8 +140,13 @@ flowchart LR
KDE Frameworks 6.14 (Fedora 44 has 6.31). Debian 13 has `kwallet6` 6.13, whose `kwalletd6`
only offers it as an option: enable it in the KDE Wallet settings ("Use KWallet for the
Secret Service interface") or use another provider.
- For the Nautilus extension: the development files of `libnautilus-extension-4`
(`nautilus-devel` on Fedora) and GTK 4.
- Optional, one per file manager you want the plugins of: for the Nautilus extension, the
development files of `libnautilus-extension-4` (`nautilus-devel` on Fedora) and GTK 4; for the
Dolphin plugins, CMake, `extra-cmake-modules` and the development files of KDE Frameworks 6
KIO, KCoreAddons, KI18n and Qt 6 (`kf6-kio-devel kf6-kcoreaddons-devel kf6-ki18n-devel
qt6-qtbase-devel` on Fedora; `libkf6kio-dev libkf6coreaddons-dev libkf6i18n-dev qt6-base-dev`
on Debian 13). `scripts/install-system.sh` builds the ones it finds. COSMIC Files needs
nothing to build.
- On GNOME: the AppIndicator extension, for the tray icon (see above).

### From source
Expand All @@ -141,8 +156,8 @@ git clone https://github.com/bpresles/PDrive-for-Linux.git
cd PDrive-for-Linux

scripts/install.sh # as your user
scripts/install-system.sh # Nautilus extension and sidebar, needs sudo
nautilus -q # restart Nautilus to load the extension
scripts/install-system.sh # Nautilus extension, Dolphin plugins and sidebar, needs sudo
nautilus -q # restart Nautilus to load the extension (Dolphin: close it)
```

`scripts/install.sh` builds the native libraries if needed (`scripts/build-native.sh`, which
Expand All @@ -157,20 +172,60 @@ in release mode and installs, under your home directory:
- `~/.local/share/man/man1/`: manual pages `pdrive(1)`, `pdrived(1)` and `pdrive-app(1)`.

`~/.local/bin` must be in your `PATH` to run the commands from a terminal. `scripts/install-system.sh`
builds the Nautilus extension and installs it in the extension directory of Nautilus, the
sidebar declaration in `/usr/local/share/cloud-providers/` and the translations of the
extension in `/usr/local/share/locale/`. It needs `sudo` because Nautilus and libcloudproviders
only read system directories.
builds the Nautilus extension (if `libnautilus-extension-4` is found) and installs it in the
extension directory of Nautilus, builds the Dolphin plugins (if CMake finds KDE Frameworks 6 KIO)
and installs them in the Qt 6 plugin directory of the system, and installs the sidebar declaration
in `/usr/local/share/cloud-providers/` and the translations in `/usr/local/share/locale/`. It
needs `sudo` because Nautilus, Dolphin and libcloudproviders only read system directories.

### First start

1. Start **PDrive** from the applications menu (or run `pdrive-app`).
2. Click "Sign in": your browser opens for the Proton sign-in (the window mentions that this
is an unofficial client). `pdrive login` does the same from a terminal.
3. The daemon mounts the drive at `~/ProtonDrive`; it is also in the Nautilus sidebar.
3. The daemon mounts the drive at `~/ProtonDrive`; it is also in the sidebar of the file managers
(see below).
4. After the first sign-in, the application offers to start at login. You can change it in the
settings (it creates `~/.config/autostart/io.github.bpresles.PDrive.App.desktop`).

### File managers

One installation serves every desktop of the machine: a package (or `install-system.sh`) installs
the plugin of each file manager, and each plugin is only loaded by its own file manager, so
switching between GNOME, KDE and COSMIC sessions needs nothing more. The packages require none of
them (`Suggests: nautilus, dolphin`) and pull no KDE or GNOME library.

| | Nautilus (GNOME) | Dolphin (KDE Plasma) | COSMIC Files |
|---|---|---|---|
| Sync state emblems | yes (extension) | yes (`KOverlayIconPlugin`) | no: no extension API |
| "Keep Available Offline" / "Free Up Space" | file menu | file menu, only on drive files | file menu, on **every** file (see below) |
| Sidebar entry | libcloudproviders (system-wide) | "Proton Drive" in Places (`user-places.xbel`) | favorite |

`pdrive-app` sets up the Dolphin places entry and the COSMIC Files favorite and actions in your
own configuration (a package cannot write it), at every start, according to the file managers
**installed**, not to the session you are running: with COSMIC and Dolphin both installed, the
Dolphin entry is added from a COSMIC session too. A file manager installed later is taken into
account at the next start of `pdrive-app`.

- Dolphin: `$XDG_DATA_HOME/user-places.xbel` is only changed if it exists (Dolphin creates it at
its first start), with a marker so that only our entry is touched.
- COSMIC Files (when `com.system76.CosmicFiles.desktop` is installed):
`~/.config/cosmic/com.system76.CosmicFiles/v1/favorites` and `.../context_actions`. COSMIC Files
cannot limit an action to a folder: "PDrive: Keep Available Offline" and "PDrive: Free Up Space"
appear on every file, and run `pdrive keep-offline` / `pdrive free-up-space`, which ignore paths
outside the drive and say so in a notification. If `pdrive` is not in the `PATH` of the session
(for example `~/.local/bin`), the actions use its full path. The favorite is recognised by the
mount point: turning the integration off removes it, even if you had added it by hand.
- The switch "Add PDrive to the file managers (sidebar, menus)" in the settings
(`file_manager_integration`, on by default) removes these entries when turned off.
`pdrive-app --remove-integrations` removes them and exits (`scripts/uninstall.sh` runs it).
Removing a package does not touch your configuration files: run it first.
- Nautilus is unchanged: no bookmark is added, its sidebar entry comes from libcloudproviders.
- The "Open folder" button opens the folder with the default application of your system, as
before.
- Not available: emblems in COSMIC Files (no API), Nemo, Thunar, Caja. The AppImage contains
none of the plugins (they live in system directories), like the Nautilus extension.

### Packages

RPM and DEB packages are meant to be published with the releases of the repository:
Expand All @@ -190,13 +245,16 @@ mountpoint = "~/ProtonDrive"
cache_size_gib = 10
# Whether launching pdrive-app opens its status window (read by pdrive-app only).
show_window_at_startup = true
# Whether pdrive-app adds the drive to the file managers (Dolphin, COSMIC Files).
file_manager_integration = true
```

| Key | Default | Meaning |
| --- | --- | --- |
| `mountpoint` | `"~/ProtonDrive"` | Folder where the drive appears (a symbolic link to the hidden real mount). |
| `cache_size_gib` | `10` | Size limit of the cache of downloaded files, in GiB. |
| `show_window_at_startup` | `true` | Open the status window when `pdrive-app` is started by hand. It is never opened with `--background` (start at login). |
| `file_manager_integration` | `true` | Add the drive to the sidebar and menus of Dolphin and COSMIC Files (switch in the settings; see [File managers](#file-managers)). |

Other locations: the content cache and the pending uploads are under `~/.cache/pdrive/`; the
hidden mount and the list of pinned files (`pinned.json`) are under `~/.local/share/pdrive/`. Setting `PDRIVE_VERBOSE=1`
Expand All @@ -220,7 +278,9 @@ Without a journal, the log is `$XDG_STATE_HOME/pdrive/pdrive.log` (by default
- Files "Shared with me" and Photos are not handled.
- `O_NOATIME` is refused on files that are not in the cache.
- Deleting a file moves it directly to the Proton trash, not to the Nautilus trash.
- Rendering on KDE and GNOME, and the translated Nautilus menus, still need more real-world testing.
- Rendering on KDE and GNOME, and the translated Nautilus and Dolphin menus, still need more real-world testing.
- COSMIC Files shows no state emblems (no extension API), and its two PDrive actions appear on every
file (they do nothing outside the drive).
- Keep a single Secret Service on the desktop. With two of them installed (for example GNOME
Keyring and oo7), whichever starts first at login answers, each with its own copy of the
session; Proton renews the session regularly and refuses the outdated copy, which then asks
Expand All @@ -236,7 +296,8 @@ the files of an RPM or DEB package. The equivalent by hand, after quitting PDriv
menu (it unmounts the drive):

```sh
# User files
# User files (first remove the entries added to Dolphin and COSMIC Files)
pdrive-app --remove-integrations
rm -f ~/.local/bin/{pdrive-app,pdrived,pdrive}
rm -rf ~/.local/lib/pdrive
rm -f ~/.local/share/applications/io.github.bpresles.PDrive.App.desktop
Expand All @@ -247,11 +308,15 @@ rm -f ~/.local/share/man/man1/{pdrive,pdrived,pdrive-app}.1

# System files
sudo rm -f "$(pkg-config --variable=extensiondir libnautilus-extension-4)/libpdrive-nautilus.so"
sudo rm -f "$(qtpaths6 --query QT_INSTALL_PLUGINS)"/kf6/{overlayicon/pdriveoverlay,kfileitemaction/pdriveactions}.so
sudo rm -f /usr/local/share/cloud-providers/io.github.bpresles.PDrive.ini
sudo rm -f /usr/local/share/locale/*/LC_MESSAGES/pdrive.mo
nautilus -q
nautilus -q # and close Dolphin
```

With a package installation, run `pdrive-app --remove-integrations` before removing the package:
the package does not touch your configuration files.

Your data: `pdrive logout` first removes the session from the keyring and revokes it. Then,
if you want, delete `~/.config/pdrive/`, `~/.cache/pdrive/` (note: this loses uploads still
pending) and `~/.local/share/pdrive/`. Files stored in Proton Drive are not affected.
Expand Down
3 changes: 3 additions & 0 deletions crates/pdrive-app/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ toml_edit = "0.25"
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls", "json"] }
serde = { version = "1", features = ["derive"] }
libc = "0.2"

[dev-dependencies]
tempfile = "3.27.0"
Loading