Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Drive: one ⋯ menu per item, and the same menu on right-click — Open or Download a Copy, Get Info, Rename, Move to Folder, Delete — as icloud.com and Finder offer it
Yashwanth Kamireddid01758eb1359
diff --git a/.uiverify/a11y.mjs b/.uiverify/a11y.mjsindex 41d4834..3d2c2c8 100644--- a/.uiverify/a11y.mjs+++ b/.uiverify/a11y.mjs@@ -100,7 +100,8 @@ const screens = [await p.click('.nav-item:has-text("iCloud Drive")');await p.waitForSelector(".drive-row-hit");await p.hover(".drive-row.is-folder");- await p.click('.drive-row.is-folder .drive-action[aria-label^="Move"]');+ await p.click('.drive-row.is-folder .drive-action[aria-label^="Actions for"]');+ await p.getByRole("menuitem", { name: "Move to Folder…" }).click();await p.waitForSelector(".modal-sheet");} },];diff --git a/.uiverify/drive-info.mjs b/.uiverify/drive-info.mjsindex f605e16..ad78cde 100644--- a/.uiverify/drive-info.mjs+++ b/.uiverify/drive-info.mjs@@ -11,12 +11,22 @@ await page.waitForTimeout(300);let failures = 0;const ok = (p, m) => { console.log(`${p ? "PASS" : "FAIL"} ${m}`); if (!p) failures++; };await page.locator(".drive-row", { hasText: "Semester Plan" }).hover();-await page.getByRole("button", { name: "Get Info for Semester Plan.pdf" }).click();+await page.getByRole("button", { name: "Actions for Semester Plan.pdf" }).click();+await page.getByRole("menuitem", { name: "Get Info" }).click();await page.waitForTimeout(200);const facts = await page.evaluate(() => Object.fromEntries([...document.querySelectorAll(".info-rows > div")].map((d) => [d.querySelector("dt").textContent, d.querySelector("dd").textContent])));ok(facts.Kind === "PDF document" && facts.Size === "2.3 MB" && facts.Where === "iCloud Drive", `File Info ${JSON.stringify(facts)}`);await page.keyboard.press("Escape");await page.waitForTimeout(150);ok((await page.locator(".info-sheet").count()) === 0, "Escape closes it");+// A right-click opens the same menu at the pointer; Escape puts it away.+await page.locator(".drive-row", { hasText: "Downloads" }).click({ button: "right" });+await page.waitForTimeout(150);+const offered = await page.getByRole("menuitem").allInnerTexts();+ok(JSON.stringify(offered) === JSON.stringify(["Open", "Get Info", "Rename", "Move to Folder…", "Delete"]),+ `a right-click on a folder offers its menu ${JSON.stringify(offered)}`);+await page.keyboard.press("Escape");+await page.waitForTimeout(100);+ok((await page.getByRole("menu").count()) === 0, "and Escape puts it away");await b.close();process.exitCode = failures ? 1 : 0;diff --git a/.uiverify/keyboard.mjs b/.uiverify/keyboard.mjsindex 1e600ee..409a557 100644--- a/.uiverify/keyboard.mjs+++ b/.uiverify/keyboard.mjs@@ -267,7 +267,8 @@ const focused = (page) =>await page.click('.nav-item:has-text("iCloud Drive")');await page.waitForSelector(".drive-row-hit");await page.hover(".drive-row.is-folder");- await page.click('.drive-row.is-folder .drive-action[aria-label^="Move"]');+ await page.click('.drive-row.is-folder .drive-action[aria-label^="Actions for"]');+ await page.getByRole("menuitem", { name: "Move to Folder…" }).click();await page.waitForSelector(".modal-sheet");// The focus move is deliberately a tick after mount (it has to win a race against thediff --git a/.uiverify/shots.mjs b/.uiverify/shots.mjsindex bdb3532..d308dbe 100644--- a/.uiverify/shots.mjs+++ b/.uiverify/shots.mjs@@ -115,7 +115,8 @@ const shots = [await p.click('.nav-item:has-text("iCloud Drive")');await p.waitForSelector(".drive-row-hit");await p.hover(".drive-row.is-folder");- await p.click('.drive-row.is-folder .drive-action[aria-label^="Move"]');+ await p.click('.drive-row.is-folder .drive-action[aria-label^="Actions for"]');+ await p.getByRole("menuitem", { name: "Move to Folder…" }).click();await p.waitForSelector(".modal-sheet");} },{ name: "04-library", screen: "library", theme: "light" },diff --git a/src/screens/DriveView.tsx b/src/screens/DriveView.tsxindex 8ac1c08..907d2f2 100644--- a/src/screens/DriveView.tsx+++ b/src/screens/DriveView.tsx@@ -1,4 +1,4 @@-import { useCallback, useEffect, useRef, useState } from "react";+import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";import { Notice } from "../components/Notice";import { open as openFileDialog } from "@tauri-apps/plugin-dialog";import { getCurrentWebview } from "@tauri-apps/api/webview";@@ -210,6 +210,81 @@ function InfoSheet({ item, where, onClose }: { item: DriveItem; where: string; o);}+type MenuEntry = { label: string; run: () => void; danger?: boolean } | null;++/**+ * A menu as macOS draws one: under the ⋯ that opened it or at the pointer for a right-click,+ * kept on screen, arrows to move, Return to choose, Escape or a click elsewhere to leave.+ */+function RowMenu({ at, entries, onClose }: {+ at: { x: number; y: number; alignRight: boolean };+ entries: MenuEntry[];+ onClose: () => void;+}) {+ const box = useRef<HTMLDivElement | null>(null);+ const [pos, setPos] = useState({ left: at.x, top: at.y });+ const items = entries.filter((e): e is NonNullable<MenuEntry> => e !== null);+ const [active, setActive] = useState(0);+ useLayoutEffect(() => {+ const el = box.current;+ if (!el) return;+ const { width, height } = el.getBoundingClientRect();+ let left = at.alignRight ? at.x - width : at.x;+ let top = at.y;+ left = Math.max(8, Math.min(left, window.innerWidth - width - 8));+ if (top + height > window.innerHeight - 8) top = Math.max(8, at.y - height - (at.alignRight ? 36 : 0));+ setPos({ left, top });+ el.focus();+ }, [at]);+ useEffect(() => {+ const down = (e: MouseEvent) => { if (!box.current?.contains(e.target as Node)) onClose(); };+ const away = () => onClose();+ document.addEventListener("mousedown", down);+ window.addEventListener("blur", away);+ window.addEventListener("resize", away);+ return () => {+ document.removeEventListener("mousedown", down);+ window.removeEventListener("blur", away);+ window.removeEventListener("resize", away);+ };+ }, [onClose]);+ const pick = (i: number) => { onClose(); items[i]?.run(); };+ let n = -1;+ return (+ <div+ ref={box}+ className="row-menu"+ role="menu"+ tabIndex={-1}+ style={{ left: pos.left, top: pos.top }}+ onKeyDown={(e) => {+ if (e.key === "Escape") { e.preventDefault(); onClose(); }+ else if (e.key === "ArrowDown") { e.preventDefault(); setActive((a) => (a + 1) % items.length); }+ else if (e.key === "ArrowUp") { e.preventDefault(); setActive((a) => (a - 1 + items.length) % items.length); }+ else if (e.key === "Enter" || e.key === " ") { e.preventDefault(); pick(active); }+ }}+ >+ {entries.map((entry, i) => {+ if (!entry) return <div key={`sep${i}`} className="row-menu-sep" role="separator" />;+ n += 1;+ const index = n;+ return (+ <button+ key={entry.label}+ role="menuitem"+ tabIndex={-1}+ className={`row-menu-item${entry.danger ? " is-danger" : ""}${index === active ? " is-active" : ""}`}+ onMouseEnter={() => setActive(index)}+ onClick={() => pick(index)}+ >+ {entry.label}+ </button>+ );+ })}+ </div>+ );+}+type Crumb = { id: string; name: string };export function DriveView() {@@ -260,6 +335,8 @@ export function DriveView() {/** The item a Move dialog is open for, if any. */const [moving, setMoving] = useState<DriveItem | null>(null);const [info, setInfo] = useState<DriveItem | null>(null);+ /** The ⋯ menu, or the same menu opened by a right-click, for one item. */+ const [menu, setMenu] = useState<{ item: DriveItem; x: number; y: number; alignRight: boolean } | null>(null);/** True while files are held over the window, so the drop target can say so. */const [dropping, setDropping] = useState(false);@@ -755,7 +832,13 @@ export function DriveView() {/></div>) : (- <div className={`drive-row${container ? " is-folder" : ""}${busy ? " is-busy" : ""}`}>+ <div+ className={`drive-row${container ? " is-folder" : ""}${busy ? " is-busy" : ""}${menu?.item.drivewsid === item.drivewsid ? " is-menu" : ""}`}+ onContextMenu={(e) => {+ e.preventDefault();+ if (!busy) setMenu({ item, x: e.clientX, y: e.clientY, alignRight: false });+ }}+ ><buttonclassName="drive-row-hit"// A folder opens; a file downloads to Downloads and reveals itself@@ -782,51 +865,18 @@ export function DriveView() {<span className="drive-meta">{modified(item.modifiedAt ?? item.createdAt)}</span></button><span className="drive-row-actions">- {!container && (- <button- className="drive-action"- aria-label={`Download ${driveName(item)}`}- title="Download"- disabled={busy}- onClick={() => void download(item)}- >- <ActionGlyph name="download" />- </button>- )}<buttonclassName="drive-action"- aria-label={`Move ${driveName(item)}`}- title="Move to…"+ aria-label={`Actions for ${driveName(item)}`}+ aria-haspopup="menu"+ title="More"disabled={busy}- onClick={() => setMoving(item)}+ onClick={(e) => {+ const r = e.currentTarget.getBoundingClientRect();+ setMenu({ item, x: r.right, y: r.bottom + 4, alignRight: true });+ }}>- <ActionGlyph name="move" />- </button>- <button- className="drive-action"- aria-label={`Rename ${driveName(item)}`}- title="Rename"- disabled={busy}- onClick={() => setRenaming(item.drivewsid)}- >- <ActionGlyph name="rename" />- </button>- <button- className="drive-action"- aria-label={`Get Info for ${driveName(item)}`}- title="Get Info"- onClick={() => setInfo(item)}- >- <ActionGlyph name="info" />- </button>- <button- className="drive-action danger"- aria-label={`Delete ${driveName(item)}`}- title="Delete"- disabled={busy}- onClick={() => void remove(item)}- >- <ActionGlyph name="delete" />+ <span aria-hidden="true" className="drive-more">•••</span></button></span></div>@@ -852,6 +902,22 @@ export function DriveView() {/>)}+ {menu && (+ <RowMenu+ at={menu}+ onClose={() => setMenu(null)}+ entries={[+ { label: isContainer(menu.item) ? "Open" : "Download a Copy", run: () => (isContainer(menu.item) ? enter(menu.item) : void download(menu.item)) },+ { label: "Get Info", run: () => setInfo(menu.item) },+ null,+ { label: "Rename", run: () => setRenaming(menu.item.drivewsid) },+ { label: "Move to Folder…", run: () => setMoving(menu.item) },+ null,+ { label: "Delete", danger: true, run: () => void remove(menu.item) },+ ]}+ />+ )}+{info && (<InfoSheet item={info} where={trail.map((c) => c.name).join(" › ")} onClose={() => setInfo(null)} />)}diff --git a/src/styles/app.css b/src/styles/app.cssindex 9d134cf..8b50ab6 100644--- a/src/styles/app.css+++ b/src/styles/app.css@@ -1735,3 +1735,25 @@.info-rows > div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-top: 1px solid var(--separator); font-size: var(--t-13); }.info-rows dt { color: var(--text-2); }.info-rows dd { margin: 0; text-align: right; overflow-wrap: anywhere; }++/* Row menus: macOS's own shape — a rounded sheet, items the width of it, a hairline between+ groups, the highlight in the accent, Delete in red. */+.row-menu {+ position: fixed; z-index: 60; min-width: 200px; padding: 5px;+ display: flex; flex-direction: column; outline: none;+ background: var(--sheet); border-radius: 10px;+ box-shadow: var(--shadow-sheet), 0 0 0 0.5px var(--glass-edge);+ animation: picker-in 120ms cubic-bezier(0.2, 0.9, 0.3, 1) both;+}+.row-menu-item {+ display: block; width: 100%; padding: 5px 10px; border: 0; border-radius: 6px;+ background: none; box-shadow: none; color: var(--text); font: inherit; font-size: var(--t-13);+ text-align: left; cursor: default;+}+.row-menu-item.is-active { background: var(--sys-blue, #0a84ff); color: #fff; }+.row-menu-item.is-danger { color: var(--sys-red, #ff453a); }+.row-menu-item.is-danger.is-active { background: var(--sys-red, #ff453a); color: #fff; }+.row-menu-sep { height: 1px; margin: 4px 8px; background: var(--separator); }+.drive-more { font-size: 9px; letter-spacing: 1px; }+.drive-row.is-menu { background: color-mix(in srgb, var(--text) 8%, transparent); }+.drive-row.is-menu .drive-row-actions { opacity: 1; }