Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34f03a1301 | ||
|
|
153e8e9f13 | ||
|
|
060219b008 | ||
|
|
7956f5a23b | ||
|
|
18a59908ba | ||
|
|
c44e2694f2 | ||
|
|
d79c26f732 |
No files matched your search
@@ -162,6 +162,7 @@ jobs:
|
||||
cp packaging/io.narl.proton-drive-linux.desktop deb/usr/share/applications/
|
||||
cp packaging/io.narl.proton-drive-linux-tray.desktop deb/etc/xdg/autostart/
|
||||
cp packaging/io.narl.proton-drive-linux.svg deb/usr/share/icons/hicolor/scalable/apps/
|
||||
install -Dm644 -t deb/usr/share/icons/hicolor/scalable/status crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
install -Dm644 packaging/io.narl.proton-drive-linux.policy deb/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy
|
||||
cp packaging/proton-drive.service deb/usr/lib/systemd/user/
|
||||
cp LICENSE deb/usr/share/licenses/proton-drive-linux/
|
||||
|
||||
@@ -637,6 +637,16 @@ impl Core {
|
||||
// answer may still have the old name (`docs/BUGS.md` B161).
|
||||
let real_key = real.to_string();
|
||||
let renaming = self.db.has_pending_op(&real_key, OP_RENAME)?;
|
||||
// Where the tree has the node before the read-back. A rename queued
|
||||
// after the check above and landed before the one under the lock
|
||||
// below leaves no op for either to see, while the read-back can still
|
||||
// have the old name. The tree moved the entry when the rename was
|
||||
// queued, so a placement that changed meanwhile is the user's
|
||||
// (docs/BUGS.md B309).
|
||||
let before = {
|
||||
let st = self.state();
|
||||
placed_in(&st, real).or_else(|| placed_in(&st, local))
|
||||
};
|
||||
// Drive answers a create before it lists the new node.
|
||||
let mut node = self
|
||||
.read_back(real)
|
||||
@@ -669,8 +679,9 @@ impl Core {
|
||||
// before it renames the entry under this lock. Asked only before,
|
||||
// a rename made since was overwritten with the name the create was
|
||||
// sent with, here and in the node row (`docs/BUGS.md` B152).
|
||||
let renaming =
|
||||
renaming || matches!(self.db.has_pending_op(&real_key, OP_RENAME), Ok(true));
|
||||
let renaming = renaming
|
||||
|| placed_in(st, real) != before
|
||||
|| matches!(self.db.has_pending_op(&real_key, OP_RENAME), Ok(true));
|
||||
if renaming && let Some(e) = st.entries.get(&ino) {
|
||||
node.name = e.node.name.clone();
|
||||
node.parent_uid = e.node.parent_uid.clone();
|
||||
|
||||
@@ -1547,6 +1547,86 @@ mod tests {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "mounts FUSE: run with `cargo test -p pdfs-fuse sim:: -- --ignored`"]
|
||||
fn a_file_renamed_while_its_create_is_read_back_keeps_its_new_name() {
|
||||
// The create had landed and the drain was reading the node back. The
|
||||
// rename came after the drain's first look for a queued rename, and
|
||||
// landed before its second, so neither saw it. The answer still had
|
||||
// the old name, which the tree took back. A rename over the new name
|
||||
// then found nothing to replace and waited on its own name (B309).
|
||||
let drive = FakeDrive::new();
|
||||
let dir = scratch("renamed-while-read-back");
|
||||
let daemon = Daemon::start(&dir, drive.client(1, Faults::lan())).unwrap();
|
||||
let mnt = daemon.mountpoint.clone().join("x");
|
||||
std::fs::create_dir(&mnt).unwrap();
|
||||
assert!(wait_until(Duration::from_secs(30), || {
|
||||
daemon.pending().is_ok_and(|items| items.is_empty()) && drive.lookup("x").is_some()
|
||||
}));
|
||||
|
||||
let create = daemon.client.hold_reply_to_next_create();
|
||||
daemon.write_new(&mnt.join("d"), b"abc").unwrap();
|
||||
assert!(wait_until(Duration::from_secs(30), || create.reached()));
|
||||
let uid = drive.lookup("x/d").unwrap();
|
||||
// Answer read-backs in turn until the create is retired; hold the
|
||||
// first one after that, which is the adoption's.
|
||||
let mut held = create;
|
||||
let adopting = loop {
|
||||
let next = daemon.client.hold_answer_to_next_read(&uid);
|
||||
drop(held);
|
||||
assert!(wait_until(Duration::from_secs(30), || next.reached()));
|
||||
if daemon
|
||||
.pending()
|
||||
.is_ok_and(|items| items.iter().all(|op| op.kind != "create"))
|
||||
{
|
||||
break next;
|
||||
}
|
||||
held = next;
|
||||
};
|
||||
std::fs::rename(mnt.join("d"), mnt.join("b.txt")).unwrap();
|
||||
assert!(
|
||||
wait_until(Duration::from_secs(10), || drive
|
||||
.lookup("x/b.txt")
|
||||
.is_some()),
|
||||
"{:?} {:?}",
|
||||
daemon.pending(),
|
||||
drive.tree()
|
||||
);
|
||||
drop(adopting);
|
||||
// Before any listing or event could put it right.
|
||||
std::thread::sleep(Duration::from_millis(100));
|
||||
assert!(mnt.join("b.txt").exists() && !mnt.join("d").exists());
|
||||
assert!(
|
||||
wait_until(Duration::from_secs(30), || {
|
||||
daemon.pending().is_ok_and(|items| items.is_empty())
|
||||
}),
|
||||
"{:?}",
|
||||
daemon.pending()
|
||||
);
|
||||
|
||||
let names: Vec<_> = std::fs::read_dir(&mnt)
|
||||
.unwrap()
|
||||
.map(|e| e.unwrap().file_name().into_string().unwrap())
|
||||
.collect();
|
||||
assert_eq!(names, ["b.txt"]);
|
||||
// And a rename over it replaces it, as it does on any file.
|
||||
daemon.write_new(&mnt.join("e.md"), b"new").unwrap();
|
||||
std::fs::rename(mnt.join("e.md"), mnt.join("b.txt")).unwrap();
|
||||
let file = Some(Entry::File(Arc::new(b"new".to_vec())));
|
||||
assert!(
|
||||
wait_until(Duration::from_secs(10), || {
|
||||
daemon.pending().is_ok_and(|items| items.is_empty())
|
||||
&& drive.tree().get("x/b.txt").cloned() == file
|
||||
}),
|
||||
"{:?} {:?}",
|
||||
daemon.pending(),
|
||||
drive.tree()
|
||||
);
|
||||
|
||||
assert!(matches!(daemon.stop(), Ok(MountOutcome::Shutdown)));
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "mounts FUSE: run with `cargo test -p pdfs-fuse sim:: -- --ignored`"]
|
||||
fn a_file_read_back_before_drive_committed_it_keeps_its_bytes() {
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V8.646A4.5 4.5 0 0 0 7.757 13.5H2Q1 13.5 1 12.5ZM8.5 12A3.5 3.5 0 1 0 15.5 12A3.5 3.5 0 1 0 8.5 12ZM11.8 9.5H12.2Q12.7 9.5 12.7 10V12.1Q12.7 12.6 12.2 12.6H11.8Q11.3 12.6 11.3 12.1V10Q11.3 9.5 11.8 9.5ZM11.25 14.05A0.75 0.75 0 1 0 12.75 14.05A0.75 0.75 0 1 0 11.25 14.05Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 741 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V8.646A4.5 4.5 0 0 0 7.757 13.5H2Q1 13.5 1 12.5ZM2.25 8.75H8.888A4.5 4.5 0 0 0 7.507 12.25H2.25ZM12 11.081L13.379 9.702L14.298 10.621L12.919 12L14.298 13.379L13.379 14.298L12 12.919L10.621 14.298L9.702 13.379L11.081 12L9.702 10.621L10.621 9.702Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 715 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V12.5Q15 13.5 14 13.5H2Q1 13.5 1 12.5ZM2.25 8.75H13.75V12.25H2.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 536 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V8.646A4.5 4.5 0 0 0 7.757 13.5H2Q1 13.5 1 12.5ZM10.1 9.25H10.8Q11.2 9.25 11.2 9.65V14.35Q11.2 14.75 10.8 14.75H10.1Q9.7 14.75 9.7 14.35V9.65Q9.7 9.25 10.1 9.25ZM13.2 9.25H13.9Q14.3 9.25 14.3 9.65V14.35Q14.3 14.75 13.9 14.75H13.2Q12.8 14.75 12.8 14.35V9.65Q12.8 9.25 13.2 9.25Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 747 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V8.646A4.5 4.5 0 0 0 7.757 13.5H2Q1 13.5 1 12.5ZM10.1 11.6V11.5A1.9 1.9 0 0 1 13.9 11.5V11.6H13.05V11.5A1.05 1.05 0 0 0 10.95 11.5V11.6ZM10.1 11.6H13.9Q14.5 11.6 14.5 12.2V14.2Q14.5 14.8 13.9 14.8H10.1Q9.5 14.8 9.5 14.2V12.2Q9.5 11.6 10.1 11.6Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 714 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V12.5Q15 13.5 14 13.5H2Q1 13.5 1 12.5Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 508 B |
@@ -0,0 +1,5 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{color:#2e3436}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4H14Q15 4 15 5V6.75H7.05L5.8 5.5H1ZM1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5H14Q15 7.5 15 8.5V8.646A4.5 4.5 0 0 0 7.757 13.5H2Q1 13.5 1 12.5ZM9.087 10.94L9.461 10.222L10.007 9.625L10.69 9.19L11.462 8.947L12.27 8.912L13.06 9.087L13.778 9.461L14.375 10.007L15.026 9.461L14.498 12.087L12.804 11.325L13.455 10.779L13.09 10.444L12.65 10.215L12.166 10.107L11.67 10.129L11.197 10.278L10.779 10.545L10.444 10.91L10.215 11.35ZM14.913 13.06L14.539 13.778L13.993 14.375L13.31 14.81L12.538 15.053L11.73 15.088L10.94 14.913L10.222 14.539L9.625 13.993L8.974 14.539L9.502 11.913L11.196 12.675L10.545 13.221L10.91 13.556L11.35 13.785L11.834 13.893L12.33 13.871L12.803 13.722L13.221 13.455L13.556 13.09L13.785 12.65Z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -28,6 +28,7 @@ use pdfs_core::control::{
|
||||
use pdfs_core::service;
|
||||
|
||||
mod i18n;
|
||||
mod tray_icons;
|
||||
use i18n::{gettext, gettext_f, ngettext_f};
|
||||
|
||||
/// How long the tray lets a burst of events arrive before it repaints. Progress
|
||||
@@ -54,17 +55,19 @@ enum Phase {
|
||||
}
|
||||
|
||||
impl Phase {
|
||||
/// A stock symbolic icon for the phase. Stock names follow the panel's
|
||||
/// theme and colour, and need nothing installed beside the binary.
|
||||
/// The tray's own symbolic icon for the phase ([`tray_icons`]). Symbolic
|
||||
/// icons take the panel's text colour.
|
||||
fn icon(self) -> &'static str {
|
||||
match self {
|
||||
Phase::Synced => "folder-remote-symbolic",
|
||||
Phase::Syncing => "view-refresh-symbolic",
|
||||
Phase::Paused => "media-playback-pause-symbolic",
|
||||
Phase::Offline => "network-offline-symbolic",
|
||||
Phase::Attention => "dialog-warning-symbolic",
|
||||
Phase::SessionExpired => "dialog-password-symbolic",
|
||||
Phase::Disconnected | Phase::SignedOut => "network-offline-symbolic",
|
||||
Phase::Synced => "io.narl.proton-drive-linux-tray-synced-symbolic",
|
||||
Phase::Syncing => "io.narl.proton-drive-linux-tray-syncing-symbolic",
|
||||
Phase::Paused => "io.narl.proton-drive-linux-tray-paused-symbolic",
|
||||
Phase::Offline => "io.narl.proton-drive-linux-tray-offline-symbolic",
|
||||
Phase::Attention => "io.narl.proton-drive-linux-tray-attention-symbolic",
|
||||
Phase::SessionExpired => "io.narl.proton-drive-linux-tray-session-expired-symbolic",
|
||||
Phase::Disconnected | Phase::SignedOut => {
|
||||
"io.narl.proton-drive-linux-tray-disconnected-symbolic"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,6 +157,9 @@ fn sync_line(items: &[TransferItem], jobs: &[JobItem]) -> String {
|
||||
struct DriveTray {
|
||||
state: DriveState,
|
||||
socket: PathBuf,
|
||||
/// Where [`tray_icons::install`] put the icons, or empty when it could
|
||||
/// not, which leaves the panel to the installed theme.
|
||||
icon_theme_path: String,
|
||||
}
|
||||
|
||||
/// Ask the daemon for its status, falling back to the stored session so the
|
||||
@@ -422,6 +428,10 @@ impl Tray for DriveTray {
|
||||
self.state.phase.icon().into()
|
||||
}
|
||||
|
||||
fn icon_theme_path(&self) -> String {
|
||||
self.icon_theme_path.clone()
|
||||
}
|
||||
|
||||
fn attention_icon_name(&self) -> String {
|
||||
self.icon_name()
|
||||
}
|
||||
@@ -608,9 +618,18 @@ fn main() -> Result<()> {
|
||||
let socket = dirs.control_socket();
|
||||
let default_mountpoint = dirs.default_mountpoint();
|
||||
|
||||
let icons = dirs.cache_dir().join("tray-icons");
|
||||
let icon_theme_path = match tray_icons::install(&icons) {
|
||||
Ok(()) => icons.to_string_lossy().into_owned(),
|
||||
Err(e) => {
|
||||
tracing::warn!(error = %e, "could not write the tray icons; using the installed theme");
|
||||
String::new()
|
||||
}
|
||||
};
|
||||
let tray = DriveTray {
|
||||
state: poll_state(&socket, &default_mountpoint),
|
||||
socket: socket.clone(),
|
||||
icon_theme_path,
|
||||
};
|
||||
|
||||
// The tray autostarts with the session and can beat the desktop's SNI
|
||||
@@ -679,15 +698,43 @@ mod tests {
|
||||
assert_eq!(phase_of(false, 0, true, false), Phase::Synced);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_phase_has_an_icon_the_tray_ships() {
|
||||
for phase in [
|
||||
Phase::Synced,
|
||||
Phase::Syncing,
|
||||
Phase::Paused,
|
||||
Phase::Offline,
|
||||
Phase::Attention,
|
||||
Phase::SessionExpired,
|
||||
Phase::Disconnected,
|
||||
Phase::SignedOut,
|
||||
] {
|
||||
assert!(
|
||||
tray_icons::ICONS
|
||||
.iter()
|
||||
.any(|(name, _)| *name == phase.icon()),
|
||||
"{phase:?}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attention_states_supply_the_icon_the_tray_requests() {
|
||||
let mut tray = DriveTray {
|
||||
state: status_state(&status(""), &[], &[], Path::new("/m")),
|
||||
socket: PathBuf::new(),
|
||||
icon_theme_path: String::new(),
|
||||
};
|
||||
for (phase, icon) in [
|
||||
(Phase::Attention, "dialog-warning-symbolic"),
|
||||
(Phase::SessionExpired, "dialog-password-symbolic"),
|
||||
(
|
||||
Phase::Attention,
|
||||
"io.narl.proton-drive-linux-tray-attention-symbolic",
|
||||
),
|
||||
(
|
||||
Phase::SessionExpired,
|
||||
"io.narl.proton-drive-linux-tray-session-expired-symbolic",
|
||||
),
|
||||
] {
|
||||
tray.state.phase = phase;
|
||||
assert_eq!(tray.status(), Status::NeedsAttention);
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//! The tray's own status icons, drawn from the app icon's folder.
|
||||
//!
|
||||
//! The packages install them into the hicolor theme. The tray also writes
|
||||
//! them to a directory of its own at start and names it as the item's
|
||||
//! `IconThemePath`, so a build run from source, or a panel that does not
|
||||
//! read the system theme again after an update, still finds them.
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
macro_rules! icon {
|
||||
($state:literal) => {
|
||||
(
|
||||
concat!("io.narl.proton-drive-linux-tray-", $state, "-symbolic"),
|
||||
include_str!(concat!(
|
||||
"../resources/icons/tray/io.narl.proton-drive-linux-tray-",
|
||||
$state,
|
||||
"-symbolic.svg"
|
||||
)),
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
/// Every icon, by name, with its SVG.
|
||||
pub const ICONS: [(&str, &str); 7] = [
|
||||
icon!("synced"),
|
||||
icon!("syncing"),
|
||||
icon!("paused"),
|
||||
icon!("offline"),
|
||||
icon!("attention"),
|
||||
icon!("session-expired"),
|
||||
icon!("disconnected"),
|
||||
];
|
||||
|
||||
/// A theme index just big enough for one scalable status directory.
|
||||
const INDEX: &str = "[Icon Theme]\nName=Hicolor\nComment=Proton Drive tray icons\n\
|
||||
Directories=scalable/status\n\n[scalable/status]\nSize=16\nMinSize=8\nMaxSize=512\n\
|
||||
Type=Scalable\nContext=Status\n";
|
||||
|
||||
/// Write the icons under `base`: as a hicolor theme, which KDE looks for in
|
||||
/// an `IconThemePath`, and loose, which GTK hosts also accept. A file that
|
||||
/// already holds the right bytes is left alone.
|
||||
pub fn install(base: &Path) -> std::io::Result<()> {
|
||||
let status = base.join("hicolor/scalable/status");
|
||||
std::fs::create_dir_all(&status)?;
|
||||
write_if_changed(&base.join("hicolor/index.theme"), INDEX)?;
|
||||
for (name, svg) in ICONS {
|
||||
let file = format!("{name}.svg");
|
||||
write_if_changed(&status.join(&file), svg)?;
|
||||
write_if_changed(&base.join(&file), svg)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_if_changed(path: &Path, contents: &str) -> std::io::Result<()> {
|
||||
if std::fs::read(path).is_ok_and(|have| have == contents.as_bytes()) {
|
||||
return Ok(());
|
||||
}
|
||||
std::fs::write(path, contents)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn every_icon_is_one_recolourable_path() {
|
||||
for (name, svg) in ICONS {
|
||||
assert!(name.ends_with("-symbolic"), "{name}");
|
||||
assert_eq!(svg.matches("<path").count(), 1, "{name}");
|
||||
for banned in ["stroke", "mask", "opacity", "<circle", "<rect"] {
|
||||
assert!(!svg.contains(banned), "{name} has {banned}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn install_writes_a_theme_and_loose_copies() {
|
||||
let dir = std::env::temp_dir().join(format!("pdfs-tray-icons-{}", std::process::id()));
|
||||
install(&dir).unwrap();
|
||||
install(&dir).unwrap();
|
||||
assert!(dir.join("hicolor/index.theme").is_file());
|
||||
for (name, svg) in ICONS {
|
||||
let themed = dir.join(format!("hicolor/scalable/status/{name}.svg"));
|
||||
assert_eq!(std::fs::read_to_string(themed).unwrap(), svg);
|
||||
assert!(dir.join(format!("{name}.svg")).is_file());
|
||||
}
|
||||
std::fs::remove_dir_all(&dir).unwrap();
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,7 @@ original wording.
|
||||
|
||||
| Entry | Title | What is left |
|
||||
|---|---|---|
|
||||
| [B310](#b310--a-write-soon-after-a-create-landed-was-kept-as-a-conflict-copy-of-it) | A write soon after a create landed was kept as a conflict copy of it | Cause not found; seen once in CI |
|
||||
| [B307](#b307--a-write-in-the-echoes-simulation-can-wait-20-s-for-a-drive-call-that-never-answers) | A write in the echoes simulation can wait 20 s for a Drive call that never answers | Cause not found; seen once in CI |
|
||||
| [B275](#b275--on-a-slow-link-a-files-last-write-can-land-only-in-a-conflict-copy) | On a slow link, a file's last write can land only in a conflict copy | Cause not found; seen once in CI |
|
||||
| [B273](#b273--a-restore-proposes-another-computers-paths-when-the-two-share-a-hostname) | A restore proposes another computer's paths when the two share a hostname | Not fixed |
|
||||
@@ -319,6 +320,7 @@ a live account since.
|
||||
|
||||
| Entry | Title |
|
||||
|---|---|
|
||||
| [B309](#b309--a-file-renamed-while-its-create-was-read-back-went-back-to-its-old-name) | A file renamed while its create was read back went back to its old name |
|
||||
| [B308](#b308--a-write-opened-over-a-queued-edit-took-the-trees-older-size) | A write opened over a queued edit took the tree's older size |
|
||||
| [B295](#b295--a-resize-the-scratch-file-refused-still-succeeded) | A resize the scratch file refused still succeeded |
|
||||
| [B293](#b293--a-large-trash-never-lists-and-empty-trash-never-empties-it) | A large trash never lists, and Empty Trash never empties it |
|
||||
@@ -411,6 +413,64 @@ a live account since.
|
||||
|
||||
Newest first.
|
||||
|
||||
### B310 — A write soon after a create landed was kept as a conflict copy of it
|
||||
|
||||
**Status:** Open
|
||||
**Found:** 2026-11-28, CI on `main` at `d79c26f`
|
||||
([run](https://github.com/narrrl/proton-drive-linux/actions/runs/46152926170), artifact
|
||||
`simulation-diagnostics`): `one_client_on_a_good_link` seed 5. `e.md` was created with 28
|
||||
bytes, and 0.6 s later `write e.md at 27 (47 bytes)` took 111 ms. The write landed only as
|
||||
`e (sync-conflict …).md`, and `e.md` kept its 28 bytes. The daemon logged `the remote revision
|
||||
changed under the queued write (expected 28 bytes at mtime 1795875819, found 28 at
|
||||
1795875820)`. Seed 5 passed 30 runs locally on the same commit, and 25 on `9667b7d`.
|
||||
**Where:** not located; the write's baseline, from `Files::install_writer` through
|
||||
`Core::remote_baseline`, against `placeholder_base` in `crates/pdfs-fuse/src/drain.rs`
|
||||
|
||||
**Cause.** Not known. The baseline has no revision id and the placeholder's local mtime, one
|
||||
second before the stamp Drive gave the create. That is the base of a write opened over the
|
||||
create's placeholder (B113). But the create had landed long before the write, and the tree
|
||||
should have had Drive's node with its revision id by then. `placeholder_base` maps exactly this
|
||||
base to the create's revision, but only while the `placeholders` entry exists. Either the tree
|
||||
still had the placeholder's stamp, or the entry was gone or never written. The log does not say
|
||||
which.
|
||||
|
||||
**Fix.** Not done. A debug log of a failing run would show the write open's base
|
||||
(`write open took the base the file has now`) and whether adoption saw a placeholder.
|
||||
|
||||
---
|
||||
|
||||
### B309 — A file renamed while its create was read back went back to its old name
|
||||
|
||||
**Status:** Fixed
|
||||
**Found:** 2026-11-28, looping `one_client_on_a_good_link` seed 5 on `d79c26f` with debug logging,
|
||||
after a CI failure of the same seed on that commit. It failed once in 38 runs:
|
||||
`liveness: the queues did not drain within 4s`, with a rename owing `b.txt is still held by a node
|
||||
whose trash or rename is queued`. Drive had `b.txt` with the bytes of the file created as `d`,
|
||||
and the model had the file renamed over it.
|
||||
**Where:** `Core::adopt_real_uid` in `crates/pdfs-fuse/src/drain/create.rs`
|
||||
|
||||
**Repro:** Create `d` and let its create land. While the drain reads the new node back, rename
|
||||
`d` to `b.txt`, and let the rename land before the read-back answers.
|
||||
|
||||
**Cause.** Adoption keeps the tree's name while a rename is queued. It asks once before the
|
||||
read-back (B161) and once under the tree lock (B152). A rename queued after the first look and
|
||||
landed before the second leaves no op for either to see, and the read-back still has the old name.
|
||||
The tree took `d` back while Drive had `b.txt`. A later `rename z/b.txt b.txt` then found no
|
||||
`b.txt` to replace, so it queued no trash. On Drive the name was taken. The rename also counted
|
||||
as a move away from `b.txt` (it left `z/b.txt`), so it waited on itself for four attempts.
|
||||
|
||||
**Fix.** Adoption notes where the tree has the node before the read-back. The tree moves an
|
||||
entry when its rename is queued, so a placement that changed meanwhile keeps the tree's name and
|
||||
folder, like a queued rename.
|
||||
|
||||
**Verified:** sim test `a_file_renamed_while_its_create_is_read_back_keeps_its_new_name`, which
|
||||
holds the adoption's read-back until the rename has landed. It fails without the fix (the mount
|
||||
shows `d`) and passes with it.
|
||||
|
||||
The CI failure of seed 5 itself is a different bug, B310.
|
||||
|
||||
---
|
||||
|
||||
### B308 — A write opened over a queued edit took the tree's older size
|
||||
|
||||
**Status:** Fixed (unverified)
|
||||
|
||||
@@ -80,6 +80,10 @@ digest of what it sent (52).
|
||||
any more.
|
||||
|
||||
### Changed
|
||||
- **The tray has its own icons.** They are the app's folder, solid when everything is up to date,
|
||||
with a badge for syncing, paused, a failing change or an expired sign-in, and hollow when
|
||||
offline or stopped. They used to be stock icons from the desktop theme. They take the panel's
|
||||
text colour like other tray icons, and the packages install them into the hicolor theme.
|
||||
- **An upload into a folder and an edit of a synced file make fewer requests.** The key that
|
||||
hashes a folder's file names is now read once per folder, not once per upload. A synced
|
||||
folder no longer reads a file again before it sends an edit. It checks that nobody else
|
||||
@@ -111,6 +115,9 @@ digest of what it sent (52).
|
||||
first pass, and whenever the change feed lost track (#53).
|
||||
|
||||
### Fixed
|
||||
- **A file renamed just as it reached Proton Drive keeps its new name.** If the rename landed
|
||||
while the app was reading the new file back, the folder could show the old name again, and a
|
||||
later rename over the new name waited and then failed (B309).
|
||||
- **A write right after another can no longer bring back old bytes or cut the file short.** When
|
||||
an upload landed just as the next edit to the same file was queued, the file could keep the
|
||||
size of the upload that landed. A write opened next then started at that size, not the queued
|
||||
|
||||
@@ -80,6 +80,13 @@ Which program opens a file you pick is set under **Preferences → Apps → Open
|
||||
offline. Its menu opens the app or `~/ProtonDrive`, pauses or resumes sync, and stops or connects
|
||||
the service.
|
||||
|
||||

|
||||
|
||||
The icon is the app's folder. A solid folder is up to date. A badge in its corner says it is
|
||||
syncing, paused, needs a look (a failing change), or needs you to sign in again (a lock). A hollow
|
||||
folder means it is offline and showing cached files, and with a cross that the service is not
|
||||
running or nobody is signed in. The icons take the panel's text colour.
|
||||
|
||||
- **GNOME** shows tray icons only with the
|
||||
[AppIndicator extension](https://extensions.gnome.org/extension/615/appindicator-support/).
|
||||
KDE Plasma and most other desktops show it without help.
|
||||
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
@@ -71,6 +71,7 @@ package() {
|
||||
"$pkgdir/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
install -Dm644 "packaging/io.narl.proton-drive-linux.svg" \
|
||||
"$pkgdir/usr/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
|
||||
install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/status" crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
|
||||
# systemd user service that runs the auto-mount daemon. Enabled per-user by
|
||||
# the GUI on login (`systemctl --user enable --now proton-drive.service`).
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pkgbase = proton-drive-for-linux-bin
|
||||
pkgdesc = Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (binaries)
|
||||
pkgver = 3.10.0
|
||||
pkgver = 4.0.0
|
||||
pkgrel = 1
|
||||
url = https://proton-drive.narl.io
|
||||
install = proton-drive.install
|
||||
@@ -23,15 +23,15 @@ pkgbase = proton-drive-for-linux-bin
|
||||
optdepends = xdg-utils: "Open folder" action in the tray menu
|
||||
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
||||
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
||||
provides = proton-drive-for-linux=3.10.0
|
||||
provides = proton-drive-linux=3.10.0
|
||||
provides = proton-drive-for-linux=4.0.0
|
||||
provides = proton-drive-linux=4.0.0
|
||||
provides = pdfs
|
||||
conflicts = proton-drive-linux
|
||||
conflicts = proton-drive-for-linux
|
||||
conflicts = proton-drive-for-linux-git
|
||||
options = !strip
|
||||
options = !debug
|
||||
source = proton-drive-linux-3.10.0-x86_64.tar.gz::https://github.com/narrrl/proton-drive-linux/releases/download/v3.10.0/proton-drive-linux-3.10.0-x86_64.tar.gz
|
||||
sha256sums = 464986f2516ecbe249f98570189bfd36c2f372205c4095eccd515325f113c651
|
||||
source = proton-drive-linux-4.0.0-x86_64.tar.gz::https://github.com/narrrl/proton-drive-linux/releases/download/v4.0.0/proton-drive-linux-4.0.0-x86_64.tar.gz
|
||||
sha256sums = e7f7f17f6c418ce26a8070abd0a10828112d25e77b70e6130d0e9bdabaafd2da
|
||||
|
||||
pkgname = proton-drive-for-linux-bin
|
||||
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Nils Pukropp <contact@narl.io>
|
||||
|
||||
pkgname=proton-drive-for-linux-bin
|
||||
pkgver=3.10.0
|
||||
pkgver=4.0.0
|
||||
pkgrel=1
|
||||
pkgdesc="Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (binaries)"
|
||||
arch=('x86_64')
|
||||
@@ -29,7 +29,7 @@ _tag="v$pkgver"
|
||||
# (desktop files, icon, user service, translations, completions) in a /usr-like
|
||||
# tree under one directory.
|
||||
source=("proton-drive-linux-$pkgver-x86_64.tar.gz::$_repo/releases/download/$_tag/proton-drive-linux-$pkgver-x86_64.tar.gz")
|
||||
sha256sums=('464986f2516ecbe249f98570189bfd36c2f372205c4095eccd515325f113c651')
|
||||
sha256sums=('e7f7f17f6c418ce26a8070abd0a10828112d25e77b70e6130d0e9bdabaafd2da')
|
||||
|
||||
package() {
|
||||
cd "$srcdir/proton-drive-linux-$pkgver-x86_64"
|
||||
@@ -44,6 +44,8 @@ package() {
|
||||
"$pkgdir/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
install -Dm644 share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg \
|
||||
"$pkgdir/usr/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
|
||||
install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/status" \
|
||||
share/icons/hicolor/scalable/status/*.svg
|
||||
|
||||
# systemd user unit for the auto-mount daemon; enabled per user, not by pacman.
|
||||
install -Dm644 lib/systemd/user/proton-drive.service \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pkgbase = proton-drive-for-linux-git
|
||||
pkgdesc = Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (git)
|
||||
pkgver = 3.10.0.r0.g5ffaa2c
|
||||
pkgver = 4.0.0.r0.g153e8e9
|
||||
pkgrel = 1
|
||||
url = https://proton-drive.narl.io
|
||||
install = proton-drive.install
|
||||
@@ -26,8 +26,8 @@ pkgbase = proton-drive-for-linux-git
|
||||
optdepends = xdg-utils: "Open folder" action in the tray menu
|
||||
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
||||
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
||||
provides = proton-drive-for-linux=3.10.0.r0.g5ffaa2c
|
||||
provides = proton-drive-linux=3.10.0.r0.g5ffaa2c
|
||||
provides = proton-drive-for-linux=4.0.0.r0.g153e8e9
|
||||
provides = proton-drive-linux=4.0.0.r0.g153e8e9
|
||||
provides = pdfs
|
||||
conflicts = proton-drive-linux
|
||||
conflicts = proton-drive-for-linux
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Nils Pukropp <contact@narl.io>
|
||||
|
||||
pkgname=proton-drive-for-linux-git
|
||||
pkgver=3.10.0.r0.g5ffaa2c
|
||||
pkgver=4.0.0.r0.g153e8e9
|
||||
pkgrel=1
|
||||
pkgdesc="Unofficial Proton Drive client: FUSE files-on-demand mount, CLI, GTK4 app, tray (git)"
|
||||
arch=('x86_64')
|
||||
@@ -75,6 +75,7 @@ package() {
|
||||
"$pkgdir/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
install -Dm644 packaging/io.narl.proton-drive-linux.svg \
|
||||
"$pkgdir/usr/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
|
||||
install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/status" crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
|
||||
# systemd user unit for the auto-mount daemon; enabled per user, not by pacman.
|
||||
install -Dm644 packaging/proton-drive.service \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pkgbase = proton-drive-for-linux
|
||||
pkgdesc = Unofficial Proton Drive client: files-on-demand FUSE mount, CLI, GTK4 app and tray
|
||||
pkgver = 3.10.0
|
||||
pkgver = 4.0.0
|
||||
pkgrel = 1
|
||||
url = https://proton-drive.narl.io
|
||||
install = proton-drive.install
|
||||
@@ -25,15 +25,15 @@ pkgbase = proton-drive-for-linux
|
||||
optdepends = xdg-utils: "Open folder" action in the tray menu
|
||||
optdepends = fzf: search-as-you-type launcher (pdfs-prompt --fzf)
|
||||
optdepends = foot: terminal that hosts pdfs-prompt --fzf when started from a keybinding
|
||||
provides = proton-drive-linux=3.10.0
|
||||
provides = proton-drive-linux=4.0.0
|
||||
provides = pdfs
|
||||
conflicts = proton-drive-linux
|
||||
conflicts = proton-drive-for-linux-bin
|
||||
conflicts = proton-drive-for-linux-git
|
||||
options = !lto
|
||||
source = proton-drive-for-linux-3.10.0.tar.gz::https://github.com/narrrl/proton-drive-linux/archive/refs/tags/v3.10.0.tar.gz
|
||||
source = proton-drive-for-linux-4.0.0.tar.gz::https://github.com/narrrl/proton-drive-linux/archive/refs/tags/v4.0.0.tar.gz
|
||||
source = basemap-v1.pmtiles::https://github.com/narrrl/proton-rs/releases/download/basemap-v1/basemap-v1.pmtiles
|
||||
sha256sums = 181abf766bed0ab7b3a7f1c1c0092e93d18ce945eb98816f5eb2c549dc8f13ad
|
||||
sha256sums = 59cfe5dc1172be6fa73cda898cfe70081d74582e8064168dde3758ed765affa4
|
||||
sha256sums = ce9acab1b7ed7f15b23e2365b1b6a580db79f4bc4421851ee673eff4c920d280
|
||||
|
||||
pkgname = proton-drive-for-linux
|
||||
@@ -1,7 +1,7 @@
|
||||
# Maintainer: Nils Pukropp <contact@narl.io>
|
||||
|
||||
pkgname=proton-drive-for-linux
|
||||
pkgver=3.10.0
|
||||
pkgver=4.0.0
|
||||
pkgrel=1
|
||||
pkgdesc="Unofficial Proton Drive client: files-on-demand FUSE mount, CLI, GTK4 app and tray"
|
||||
arch=('x86_64')
|
||||
@@ -27,7 +27,7 @@ options=('!lto')
|
||||
install=proton-drive.install
|
||||
source=("$pkgname-$pkgver.tar.gz::$_repo/archive/refs/tags/v$pkgver.tar.gz"
|
||||
"basemap-v1.pmtiles::https://github.com/narrrl/proton-rs/releases/download/basemap-v1/basemap-v1.pmtiles")
|
||||
sha256sums=('181abf766bed0ab7b3a7f1c1c0092e93d18ce945eb98816f5eb2c549dc8f13ad'
|
||||
sha256sums=('59cfe5dc1172be6fa73cda898cfe70081d74582e8064168dde3758ed765affa4'
|
||||
'ce9acab1b7ed7f15b23e2365b1b6a580db79f4bc4421851ee673eff4c920d280')
|
||||
|
||||
_srcname="proton-drive-linux-$pkgver"
|
||||
@@ -70,6 +70,7 @@ package() {
|
||||
"$pkgdir/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
install -Dm644 packaging/io.narl.proton-drive-linux.svg \
|
||||
"$pkgdir/usr/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
|
||||
install -Dm644 -t "$pkgdir/usr/share/icons/hicolor/scalable/status" crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
|
||||
# systemd user unit for the auto-mount daemon; enabled per user, not by pacman.
|
||||
install -Dm644 packaging/proton-drive.service \
|
||||
|
||||
@@ -103,6 +103,7 @@ rustPlatform.buildRustPackage {
|
||||
$out/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop
|
||||
install -Dm644 packaging/io.narl.proton-drive-linux.svg \
|
||||
$out/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg
|
||||
install -Dm644 -t $out/share/icons/hicolor/scalable/status crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
substituteInPlace $out/share/applications/io.narl.proton-drive-linux.desktop \
|
||||
--replace-fail "Exec=pdfs-app" "Exec=$out/bin/pdfs-app"
|
||||
substituteInPlace $out/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop \
|
||||
|
||||
@@ -119,6 +119,8 @@ install -D -m0644 %{src}/packaging/io.narl.proton-drive-linux-tray.desktop \
|
||||
%{buildroot}%{_sysconfdir}/xdg/autostart/io.narl.proton-drive-linux-tray.desktop
|
||||
install -D -m0644 %{src}/packaging/io.narl.proton-drive-linux.svg \
|
||||
%{buildroot}%{_datadir}/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg
|
||||
install -D -m0644 -t %{buildroot}%{_datadir}/icons/hicolor/scalable/status \
|
||||
%{src}/crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
install -D -m0644 %{src}/packaging/io.narl.proton-drive-linux.policy \
|
||||
%{buildroot}/usr/share/polkit-1/actions/io.narl.proton-drive-linux.policy
|
||||
install -D -m0644 %{src}/packaging/proton-drive.service \
|
||||
@@ -166,6 +168,7 @@ fi
|
||||
%{_datadir}/applications/io.narl.proton-drive-linux.desktop
|
||||
%{_sysconfdir}/xdg/autostart/io.narl.proton-drive-linux-tray.desktop
|
||||
%{_datadir}/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg
|
||||
%{_datadir}/icons/hicolor/scalable/status/io.narl.proton-drive-linux-tray-*-symbolic.svg
|
||||
/usr/lib/systemd/user/proton-drive.service
|
||||
%{_datadir}/polkit-1/actions/io.narl.proton-drive-linux.policy
|
||||
%{_datadir}/locale/*/LC_MESSAGES/pdfs.mo
|
||||
|
||||
@@ -32,6 +32,7 @@ install -Dm644 "$repo/packaging/io.narl.proton-drive-linux-tray.desktop" \
|
||||
"$root/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
install -Dm644 "$repo/packaging/io.narl.proton-drive-linux.svg" \
|
||||
"$root/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
|
||||
install -Dm644 -t "$root/share/icons/hicolor/scalable/status" "$repo"/crates/pdfs-gui/resources/icons/tray/*.svg
|
||||
install -Dm644 "$repo/packaging/io.narl.proton-drive-linux.policy" \
|
||||
"$root/share/polkit-1/actions/io.narl.proton-drive-linux.policy"
|
||||
install -Dm644 "$repo/packaging/proton-drive.service" \
|
||||
|
||||
@@ -63,6 +63,7 @@ grep -qx "Exec=\"$prefix/bin/pdfs-tray\"" "$tray" || fail "the tray's Exec= was
|
||||
grep -qx "ExecStart=\"$prefix/bin/pdfs\" daemon" "$unit" || fail "ExecStart= was not rewritten: $(grep ^ExecStart= "$unit")"
|
||||
[ -f "$prefix/share/locale/de/LC_MESSAGES/pdfs.mo" ] || fail "no translations"
|
||||
[ -f "$prefix/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg" ] || fail "no icon"
|
||||
[ -f "$prefix/share/icons/hicolor/scalable/status/io.narl.proton-drive-linux-tray-synced-symbolic.svg" ] || fail "no tray icons"
|
||||
[ -f "$prefix/share/bash-completion/completions/pdfs" ] || fail "no bash completion"
|
||||
[ -f "$prefix/share/proton-drive-linux/basemap-v1.pmtiles" ] || fail "no Places basemap"
|
||||
[ ! -e "$prefix/share/proton-drive-linux/managed-updates" ] || fail "the update check must stay on offer"
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Write the tray's symbolic status icons to crates/pdfs-gui/resources/icons/tray/.
|
||||
|
||||
Each icon is the app icon's folder, reduced to one colour on a 16 px grid,
|
||||
with a small badge for the state in a bite out of its lower right corner.
|
||||
|
||||
Panels recolour symbolic icons, and several do it by forcing the fill of
|
||||
every path, rect and circle. So every shape here is a filled path in one
|
||||
colour: no strokes, masks or opacity. Holes come from the even-odd rule.
|
||||
|
||||
Run it again after changing a shape: python3 -I scripts/render-tray-icons.py
|
||||
"""
|
||||
|
||||
import math
|
||||
import pathlib
|
||||
|
||||
OUT = (
|
||||
pathlib.Path(__file__).resolve().parent.parent
|
||||
/ "crates" / "pdfs-gui" / "resources" / "icons" / "tray"
|
||||
)
|
||||
PREFIX = "io.narl.proton-drive-linux-tray"
|
||||
|
||||
# The badge sits on a circle of radius BITE around (CX, CY), and the folder
|
||||
# keeps a one-pixel gap from it.
|
||||
CX, CY, BITE = 12.0, 12.0, 4.5
|
||||
|
||||
|
||||
def f(v):
|
||||
return f"{v:.3f}".rstrip("0").rstrip(".")
|
||||
|
||||
|
||||
def pt(x, y):
|
||||
return f"{f(x)} {f(y)}"
|
||||
|
||||
|
||||
def polar(r, deg):
|
||||
a = math.radians(deg)
|
||||
return CX + r * math.cos(a), CY + r * math.sin(a)
|
||||
|
||||
|
||||
def circle(cx, cy, r):
|
||||
return (
|
||||
f"M{pt(cx - r, cy)}A{f(r)} {f(r)} 0 1 0 {pt(cx + r, cy)}"
|
||||
f"A{f(r)} {f(r)} 0 1 0 {pt(cx - r, cy)}Z"
|
||||
)
|
||||
|
||||
|
||||
def rounded_rect(x0, y0, x1, y1, r):
|
||||
return (
|
||||
f"M{pt(x0 + r, y0)}H{f(x1 - r)}Q{pt(x1, y0)} {pt(x1, y0 + r)}"
|
||||
f"V{f(y1 - r)}Q{pt(x1, y1)} {pt(x1 - r, y1)}H{f(x0 + r)}"
|
||||
f"Q{pt(x0, y1)} {pt(x0, y1 - r)}V{f(y0 + r)}Q{pt(x0, y0)} {pt(x0 + r, y0)}Z"
|
||||
)
|
||||
|
||||
|
||||
def bite_from_right(x, y_bottom):
|
||||
"""The bite's arc, from where it crosses the edge x = `x` to where it
|
||||
crosses the edge y = `y_bottom`, going round its upper left."""
|
||||
y = CY - math.sqrt(BITE**2 - (x - CX) ** 2)
|
||||
bx = CX - math.sqrt(BITE**2 - (y_bottom - CY) ** 2)
|
||||
return y, f"A{f(BITE)} {f(BITE)} 0 0 0 {pt(bx, y_bottom)}"
|
||||
|
||||
|
||||
# The back of the folder: its tab, and the band the front flap leaves.
|
||||
# Its lower edge follows the front flap's top 0.75 px higher.
|
||||
BACK = (
|
||||
"M1 3.5Q1 2.5 2 2.5H5.6Q6.1 2.5 6.45 2.85L7.4 3.8Q7.6 4 7.9 4"
|
||||
"H14Q15 4 15 5V6.75H7.05L5.8 5.5H1Z"
|
||||
)
|
||||
# The front flap has a tab of its own, as in the app icon, so the two
|
||||
# flaps read as the app's folder rather than a stock one.
|
||||
FRONT_TOP = (
|
||||
"M1 7.25Q1 6.25 2 6.25H5.2Q5.6 6.25 5.9 6.55L6.6 7.25Q6.85 7.5 7.2 7.5"
|
||||
"H14Q15 7.5 15 8.5"
|
||||
)
|
||||
RIGHT, BOTTOM = 15.0, 13.5
|
||||
|
||||
|
||||
def front(bitten):
|
||||
if not bitten:
|
||||
return FRONT_TOP + "V12.5Q15 13.5 14 13.5H2Q1 13.5 1 12.5Z"
|
||||
y, arc = bite_from_right(RIGHT, BOTTOM)
|
||||
return FRONT_TOP + f"V{f(y)}{arc}H2Q1 13.5 1 12.5Z"
|
||||
|
||||
|
||||
def front_hole(bitten):
|
||||
"""The inside of a hollow front flap: a 1.25 px wall below its tab."""
|
||||
x0, y0, x1, y1 = 2.25, 8.75, 13.75, 12.25
|
||||
if not bitten:
|
||||
return f"M{pt(x0, y0)}H{f(x1)}V{f(y1)}H{f(x0)}Z"
|
||||
# The bite crosses the top of the hole, not its right side.
|
||||
tx = CX - math.sqrt(BITE**2 - (y0 - CY) ** 2)
|
||||
bx = CX - math.sqrt(BITE**2 - (y1 - CY) ** 2)
|
||||
return (
|
||||
f"M{pt(x0, y0)}H{f(tx)}A{f(BITE)} {f(BITE)} 0 0 0 {pt(bx, y1)}"
|
||||
f"H{f(x0)}Z"
|
||||
)
|
||||
|
||||
|
||||
def arrow(start, end, inner=1.9, outer=3.1, head=0.85):
|
||||
"""A thick arc from `start` to `end` degrees, clockwise on screen, with an
|
||||
arrowhead at `end`."""
|
||||
mid = (inner + outer) / 2
|
||||
steps = 8
|
||||
out = [polar(outer, start + (end - start) * i / steps) for i in range(steps + 1)]
|
||||
inn = [polar(inner, end - (end - start) * i / steps) for i in range(steps + 1)]
|
||||
tip = polar(mid, end + 42)
|
||||
head_out = polar(outer + head, end)
|
||||
head_in = polar(inner - head, end)
|
||||
points = out + [head_out, tip, head_in] + inn
|
||||
return "M" + "L".join(pt(*p) for p in points) + "Z"
|
||||
|
||||
|
||||
def bars(points):
|
||||
return "M" + "L".join(pt(CX + x, CY + y) for x, y in points) + "Z"
|
||||
|
||||
|
||||
def cross(length=2.6, width=0.65):
|
||||
a, w = length / math.sqrt(2), width / math.sqrt(2)
|
||||
# A plus sign turned 45 degrees: twelve corners.
|
||||
pts = [
|
||||
(0, -2 * w), (a - w, -a - w), (a + w, -a + w), (2 * w, 0),
|
||||
(a + w, a - w), (a - w, a + w), (0, 2 * w), (-a + w, a + w),
|
||||
(-a - w, a - w), (-2 * w, 0), (-a - w, -a + w), (-a + w, -a - w),
|
||||
]
|
||||
return bars(pts)
|
||||
|
||||
|
||||
def lock():
|
||||
body = rounded_rect(9.5, 11.6, 14.5, 14.8, 0.6)
|
||||
# The shackle: half a ring, open at the bottom where it meets the body.
|
||||
ro, ri, cy = 1.9, 1.05, 11.6
|
||||
shackle = (
|
||||
f"M{pt(CX - ro, cy)}V{f(cy - 0.1)}A{f(ro)} {f(ro)} 0 0 1 {pt(CX + ro, cy - 0.1)}"
|
||||
f"V{f(cy)}H{f(CX + ri)}V{f(cy - 0.1)}A{f(ri)} {f(ri)} 0 0 0 {pt(CX - ri, cy - 0.1)}"
|
||||
f"V{f(cy)}Z"
|
||||
)
|
||||
return shackle + body
|
||||
|
||||
|
||||
# A disc with the badge's mark cut out, for the states that need a look.
|
||||
def disc_with(mark):
|
||||
return circle(CX, CY, 3.5) + mark
|
||||
|
||||
|
||||
BADGES = {
|
||||
"syncing": arrow(200, 320) + arrow(20, 140),
|
||||
"paused": rounded_rect(9.7, 9.25, 11.2, 14.75, 0.4)
|
||||
+ rounded_rect(12.8, 9.25, 14.3, 14.75, 0.4),
|
||||
"attention": disc_with(
|
||||
rounded_rect(11.3, 9.5, 12.7, 12.6, 0.5) + circle(12, 14.05, 0.75)
|
||||
),
|
||||
"session-expired": lock(),
|
||||
"disconnected": cross(),
|
||||
}
|
||||
|
||||
# State: (hollow front flap, badge).
|
||||
ICONS = {
|
||||
"synced": (False, None),
|
||||
"syncing": (False, "syncing"),
|
||||
"paused": (False, "paused"),
|
||||
"attention": (False, "attention"),
|
||||
"session-expired": (False, "session-expired"),
|
||||
"offline": (True, None),
|
||||
"disconnected": (True, "disconnected"),
|
||||
}
|
||||
|
||||
TEMPLATE = """<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<!-- Generated by scripts/render-tray-icons.py; edit that, not this. -->
|
||||
<style>.ColorScheme-Text{{color:#2e3436}}</style>
|
||||
<path class="ColorScheme-Text" fill="currentColor" fill-rule="evenodd" d="{d}"/>
|
||||
</svg>
|
||||
"""
|
||||
|
||||
|
||||
def main():
|
||||
OUT.mkdir(parents=True, exist_ok=True)
|
||||
for name, (hollow, badge) in ICONS.items():
|
||||
bitten = badge is not None
|
||||
d = BACK + front(bitten)
|
||||
if hollow:
|
||||
d += front_hole(bitten)
|
||||
if badge:
|
||||
d += BADGES[badge]
|
||||
path = OUT / f"{PREFIX}-{name}-symbolic.svg"
|
||||
path.write_text(TEMPLATE.format(d=d))
|
||||
print(path.relative_to(OUT.parents[4]))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||