Skip to content

Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.

Photos: a Liquid Glass toolbar over the library, as macOS 26 Photos has it

Yashwanth Kamireddid1accce01fc9
diff --git a/.uiverify/photos.mjs b/.uiverify/photos.mjs
index fec6438..bbedba8 100644
--- a/.uiverify/photos.mjs
+++ b/.uiverify/photos.mjs
@@ -87,9 +87,15 @@ ok((await page.locator(".px-viewer").count()) === 0, "Escape closes the viewer")
const across = async () => page.locator(".px-grid").first().evaluate((g) => getComputedStyle(g).gridTemplateColumns.split(" ").length);
const before = await across();
-await page.getByLabel("Zoom").fill("3");
+await page.getByRole("button", { name: "Zoom In" }).click();
+await page.getByRole("button", { name: "Zoom In" }).click();
await page.waitForTimeout(100);
-ok((await across()) < before, `zooming in shows fewer across ${before} → ${await across()}`);
+ok((await across()) < before, `Zoom In shows fewer across ${before} → ${await across()}`);
+ok(await page.getByRole("button", { name: "Zoom In" }).isDisabled(), "and stops at the closest");
+await page.keyboard.press("Control+-");
+await page.waitForTimeout(100);
+ok((await page.getByRole("button", { name: "Zoom In" }).isEnabled()), "Ctrl − zooms back out, as in Photos");
+ok(/Photos?, 1 Video/.test(await page.locator(".px-tally").innerText()), `the foot of the library says what it holds ${await page.locator(".px-tally").innerText()}`);
// Adding: the chosen photos go to the library, each shown in the tray as it goes; a file
// Photos can't take says why at once; Cancel stops the rest; a clean finish clears itself.
diff --git a/src/screens/PhotosView.tsx b/src/screens/PhotosView.tsx
index f2024bf..275060b 100644
--- a/src/screens/PhotosView.tsx
+++ b/src/screens/PhotosView.tsx
@@ -7,7 +7,7 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { listen } from "@tauri-apps/api/event";
import { getCurrentWebview } from "@tauri-apps/api/webview";
import { open as openFileDialog } from "@tauri-apps/plugin-dialog";
-import { ChevronLeft, ChevronRight, CopyMinus, CopyPlus, Download, Heart, Info, Play, Plus, RotateCcw, Trash2, X } from "lucide-react";
+import { ChevronLeft, ChevronRight, CopyMinus, CopyPlus, Download, Heart, ImagePlus, Info, Minus, Play, Plus, RotateCcw, Trash2, X } from "lucide-react";
import {
api,
messageOf,
@@ -403,6 +403,58 @@ export function PhotosView() {
};
}, [add]);
+ // Under the title, the stretch of time shown — "September – October 2026" — as Photos has it.
+ const span = useMemo(() => {
+ if (!photos || photos.length === 0) return null;
+ const times = photos.map((p) => p.takenAt);
+ const [a, b] = [new Date(Math.min(...times) * 1000), new Date(Math.max(...times) * 1000)];
+ const month = (d: Date, year: boolean) => d.toLocaleDateString(undefined, year ? { month: "long", year: "numeric" } : { month: "long" });
+ if (a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth()) return month(b, true);
+ return `${month(a, a.getFullYear() !== b.getFullYear())} – ${month(b, true)}`;
+ }, [photos]);
+ // At the foot of the library, what it holds: "132 Photos, 2 Videos".
+ const tally = useMemo(() => {
+ if (!photos || photos.length === 0) return null;
+ const videos = photos.filter((p) => p.kind === "video").length;
+ const stills = photos.length - videos;
+ const part = (n: number, one: string) => `${n.toLocaleString()} ${n === 1 ? one : `${one}s`}`;
+ return [stills && part(stills, "Photo"), videos && part(videos, "Video")].filter(Boolean).join(", ");
+ }, [photos]);
+
+ // Scrolled, the line under the title names the month at the top of the view, as Photos
+ // does; read once a frame at most, and set only when it changes.
+ const [here, setHere] = useState<string | null>(null);
+ const scroller = useRef<HTMLDivElement | null>(null);
+ const looking = useRef(false);
+ const onScroll = useCallback(() => {
+ if (looking.current) return;
+ looking.current = true;
+ requestAnimationFrame(() => {
+ looking.current = false;
+ const el = scroller.current;
+ if (!el || album) return setHere(null);
+ if (el.scrollTop < 24) return setHere(null);
+ const edge = el.getBoundingClientRect().top + 96;
+ for (const m of el.querySelectorAll<HTMLElement>(".px-month")) {
+ if (m.getBoundingClientRect().bottom > edge) return setHere(m.getAttribute("aria-label"));
+ }
+ });
+ }, [album]);
+ useEffect(() => setHere(null), [view, album]);
+
+ // Zoom from the keys as in Photos: Ctrl and + or −.
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ if (!(e.ctrlKey || e.metaKey) || e.altKey) return;
+ if (e.key === "=" || e.key === "+") setZoom((z) => Math.min(ACROSS.length - 1, z + 1));
+ else if (e.key === "-") setZoom((z) => Math.max(0, z - 1));
+ else return;
+ e.preventDefault();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, []);
+
const title = album?.name ?? VIEWS.find((v) => v.key === view)?.label ?? "Photos";
const across = ACROSS[zoom];
@@ -466,26 +518,26 @@ export function PhotosView() {
</aside>
<section className="px-main" aria-label={title}>
+ {/* As in Photos on macOS 26: the title and the controls float over the library, which
+ scrolls beneath them and fades out at the top edge. */}
<header className="px-bar">
- <h1>{title}</h1>
- <span className="px-total">
- {photos ? `${photos.length} ${photos.length === 1 ? "item" : "items"}` : ""}
- </span>
- <label className="px-zoom">
- <span className="visually-hidden">Zoom</span>
- <input
- type="range"
- min={0}
- max={ACROSS.length - 1}
- step={1}
- value={zoom}
- aria-label="Zoom"
- onChange={(e) => setZoom(Number(e.target.value))}
- />
- </label>
- <button className="px-add" onClick={() => void choose()} title="Add photos and videos" aria-label="Add Photos">
- <Plus size={16} strokeWidth={2} aria-hidden="true" />
- </button>
+ <div className="px-heading">
+ <h1>{title}</h1>
+ {(here ?? span) && <p className="px-span">{here ?? span}</p>}
+ </div>
+ <div className="px-capsule" role="group" aria-label="Zoom">
+ <button className="px-cap" aria-label="Zoom Out" title="Zoom Out (Ctrl −)" disabled={zoom === 0} onClick={() => setZoom((z) => Math.max(0, z - 1))}>
+ <Minus size={15} strokeWidth={2.2} aria-hidden="true" />
+ </button>
+ <button className="px-cap" aria-label="Zoom In" title="Zoom In (Ctrl +)" disabled={zoom === ACROSS.length - 1} onClick={() => setZoom((z) => Math.min(ACROSS.length - 1, z + 1))}>
+ <Plus size={15} strokeWidth={2.2} aria-hidden="true" />
+ </button>
+ </div>
+ <div className="px-capsule">
+ <button className="px-cap px-add" onClick={() => void choose()} title="Add photos and videos" aria-label="Add Photos">
+ <ImagePlus size={16} strokeWidth={1.9} aria-hidden="true" />
+ </button>
+ </div>
</header>
{error && (
@@ -506,7 +558,7 @@ export function PhotosView() {
</p>
)}
- <div className="px-scroll" style={{ "--across": across } as React.CSSProperties}>
+ <div className="px-scroll" ref={scroller} onScroll={onScroll} style={{ "--across": across } as React.CSSProperties}>
{months.map((m) => (
<section key={m.label} className="px-month" aria-label={m.label}>
{m.label && <h2 className="px-month-title">{m.label}</h2>}
@@ -538,6 +590,7 @@ export function PhotosView() {
</div>
</section>
))}
+ {tally && <p className="px-tally">{tally}</p>}
</div>
{shown && (
diff --git a/src/styles/photos.css b/src/styles/photos.css
index 344d47a..4abf9e8 100644
--- a/src/styles/photos.css
+++ b/src/styles/photos.css
@@ -77,33 +77,71 @@
.px-count { color: var(--text-3); font-variant-numeric: tabular-nums; font-size: var(--t-12, 12px); }
/* ---- the library ------------------------------------------------------------------------- */
-.px-notice { padding: 0 18px; }
+.px-notice { position: absolute; z-index: 5; top: 62px; left: 18px; right: 18px; max-width: 420px; }
.px-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.px-bar {
+ position: absolute;
+ inset: 0 0 auto 0;
+ z-index: 4;
+ display: flex;
+ align-items: flex-start;
+ gap: 8px;
+ padding: 12px 16px 0 18px;
+ pointer-events: none;
+}
+.px-bar > * { pointer-events: auto; }
+.px-heading { margin-right: auto; min-width: 0; }
+.px-bar h1 {
+ margin: 0;
+ font-size: var(--t-22, 22px);
+ font-weight: 700;
+ letter-spacing: -0.015em;
+ line-height: 1.15;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+.px-span { margin: 1px 0 0; color: var(--text-2); font-size: var(--t-13); font-weight: 500; }
+
+/* Liquid Glass, as Photos' toolbar has it: small capsules floating over the photos. The live
+ blur is kept to these few small, still surfaces — never to what moves, which WebKitGTK
+ would re-blur on every frame of a scroll. */
+.px-capsule {
display: flex;
- align-items: baseline;
- gap: 10px;
- padding: 14px 18px 10px;
+ height: 34px;
+ padding: 0 3px;
+ border-radius: 17px;
+ background: var(--glass);
+ -webkit-backdrop-filter: var(--glass-blur);
+ backdrop-filter: var(--glass-blur);
+ box-shadow: var(--glass-float);
}
-.px-bar h1 { margin: 0; font-size: var(--t-22, 22px); font-weight: 700; letter-spacing: -0.01em; }
-.px-total { color: var(--text-3); font-size: var(--t-13); font-variant-numeric: tabular-nums; }
-.px-zoom { margin-left: auto; align-self: center; }
-.px-zoom input { width: 120px; accent-color: var(--accent); }
-.px-add {
- align-self: center;
+.px-cap {
display: grid;
place-items: center;
- width: 28px;
- height: 28px;
+ width: 34px;
+ height: 34px;
+ padding: 0;
border: 0;
- border-radius: 8px;
+ border-radius: 17px;
background: transparent;
- color: var(--text-2);
+ color: var(--text);
cursor: default;
+ transition: background-color 120ms ease, transform 160ms var(--spring-quick);
+}
+.px-cap:hover:not(:disabled) { background: color-mix(in srgb, var(--text) 8%, transparent); }
+.px-cap:active:not(:disabled) { transform: scale(0.9); }
+.px-cap:disabled { color: var(--text-3); opacity: 0.55; }
+.px-cap:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: -2px; }
+
+.px-tally {
+ margin: 18px 0 8px;
+ color: var(--text-2);
+ font-size: var(--t-13);
+ font-weight: 600;
+ text-align: center;
+ font-variant-numeric: tabular-nums;
}
-.px-add:hover { background: color-mix(in srgb, currentColor 9%, transparent); color: var(--text); }
-.px-add:active { transform: scale(0.94); }
-.px-add:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
/* A drop into the library: the whole window answers, as Photos does. No live blur — WebKitGTK
repaints it every frame the pointer moves. */
@@ -125,17 +163,22 @@
}
.px-empty { margin: 18vh auto 0; max-width: 36ch; color: var(--text-2); text-align: center; }
-.px-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2px 24px; }
+/* The library runs up under the floating bar and fades out against the top edge — Apple's
+ scroll edge effect, done with a mask, which costs nothing per frame. */
+.px-scroll {
+ flex: 1;
+ min-height: 0;
+ overflow-y: auto;
+ padding: 80px 2px 24px;
+ -webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent 44px, #000 104px);
+ mask-image: linear-gradient(to bottom, transparent 0, transparent 44px, #000 104px);
+}
/* A month off screen is not laid out or painted until it nears it: a library of thousands
scrolls as lightly as one of a hundred. */
.px-month { content-visibility: auto; contain-intrinsic-size: auto 600px; }
.px-month-title {
- position: sticky;
- top: 0;
- z-index: 1;
margin: 0;
padding: 12px 16px 8px;
- background: var(--bg);
font-size: var(--t-17, 17px);
font-weight: 700;
letter-spacing: -0.01em;