Reported: "参考nex_squid的代码,进一步降低软件本身占用的系统资源." The
pattern worth copying out of nex_squid's `useSystemSnapshot` is that a
poll stops when nothing can see its answer. Shift had four places that
polled for the life of the process instead.
- `native/macos/drag-bridge.swift` — a separate tracked process polling at
30 Hz forever, and allocating a CGEvent each pass to read a cursor
position nothing wants while no button is held. A/B against the shipped
0.1.11 binary: 20 ms CPU per 6 s idle is now 0 ms, while 12 s of holding
the button still costs 30 ms either way, so a gesture is sampled exactly
as finely as before and an idle Shift stops touching the CPU. It runs at
10 Hz until the button goes down.
- `src-tauri/src/drag_bridge.rs` — the Windows gesture watch slept 33 ms
unconditionally. An *enabled* ring keeps 33 ms, and not from
conservatism: the loop has to observe the press to measure the drag
threshold from where the button went down, so slowing it does not notice
a gesture late, it never records it. Only a switched-off ring can afford
a quarter second, since the one thing it waits for is the switch.
- `src-tauri/src/share.rs` — the discovery loop. Measured on the 0.1.11
bundle: 0.22% CPU with ShiftDrop on, 0.03% with it off. Switching the
feature off means "stop announcing", never "be deaf" — a silent copy
still hears beacons so another machine can still find and send to it, and
expiry must keep running or an hour-old peer pretends to be live forever.
So the saving comes from waking less often while silent and from skipping
bookkeeping when there is no peer to expire, not from probing less.
Announce and sweep intervals are untouched, so discovery stays as fast.
`a_silent_copy_still_knows_and_still_loses_peers` pins that distinction.
- `src/components/MainWindow.tsx` — the 30 s clock ticked for the life of
the app while Shift sits parked in the menu bar with this window hidden,
re-rendering a list nobody could see. It now exists only while the page is
visible, and an empty library is not worth a render at all.
Co-Authored-By: Codex <noreply@openai.com>
Reported: "钉在屏幕上的图片放大按钮无效." There was no enlarge button to
be ineffective — the pin window shipped exactly two actions, copy and
close, so the third press a user went looking for did not exist.
One button now covers both directions: fill the screen, or return to the
size the image was pinned at. An enlarged pin that cannot be shrunk back
is no longer usable as a reference, and a second control for that would
spend hover space on the less common half of the gesture.
Sizing and placement are the whole feature, and both are pinned by tests
because each is correct on the machine that builds it and wrong elsewhere:
- the bound is the monitor's work area, not its size, or the window grows
under the menu bar and a borderless window cannot be dragged back onto
itself;
- `set_size` is told in logical pixels and `set_position` in physical
ones, which on a 2x display is the difference between filling the screen
and filling it twice from the wrong corner;
- size is set before position, because on a mixed-DPI desktop resizing can
move a window onto another monitor and change its own scale factor;
- growth is capped at 3x, since the preview is already capped at 1040 px
and past that the button delivers mosaic, not detail;
- the window grows from its centre and is clamped inside the work area, so
a pin parked against a screen edge grows inward rather than off.
A fresh pin always opens at the small size. The window is reused rather
than rebuilt, so without that a user who enlarged once would find every
later pin arriving full-screen and soft.
Co-Authored-By: Codex <noreply@openai.com>
Two changes to the same row, so they land together.
Reported: "操作列表中 收藏的文件 前面增加一个指示器." The star that *sets*
a favourite lives in the row's action cluster, and that cluster is
`opacity: 0` until the pointer arrives, so in a list whose entire purpose
is outliving the files it names, a favourited file looked exactly like an
ordinary one until you hovered it. The mark now sits on the leading corner
of the thumbnail, on its own disc so it stays readable over a picture that
happens to be dark, and `pointer-events: none` keeps it from intercepting
the row's open or drag-out.
While the row was open: `loading="lazy"` only defers a decode, it never
releases one. Measured in WKWebView across 250 real screenshots, 13 images
were decoded at rest and the count climbed monotonically to 136 scrolling
to the bottom without ever dropping, because the whole list is laid out in
one scroller and every image is fetched on mount. Rows are now gated on an
IntersectionObserver rooted on the list itself — an ancestor's clip is
applied before the viewport root is consulted, so measuring against the
viewport would make the margin do nothing — holding roughly 20 live bitmaps
across the same scroll. A row that scrolls away gives its bitmap back, and
the kind glyph stands in, which is the face the row already showed before a
thumbnail arrived.
Co-Authored-By: Codex <noreply@openai.com>
Reported: "在windows机器上实测一键安装组件会失败." Four independent
defects hid inside the same ten lines of `install_target_package`:
- `winget`'s benign codes — 0x8A15002B already installed, 0x8A150016 no
upgrade applicable — were read as failures, so a machine that already
had the tool was guaranteed to be told the install failed.
- `--source` was never pinned, so on a host that also carries msstore
`winget` could block on a source agreement `--silent` never answers,
and the 15-minute deadline turned a hang into the same failure.
- Machine-level packages (Poppler, FFmpeg, ImageMagick, Typst) install
into Program Files and need admin, and Shift is an unelevated GUI
process. There was no elevation path at all.
- Post-install verification could not succeed even when the install did:
a process keeps the environment block it was launched with, so the
WinGet Links directory written to the registry never reached the live
`which` lookup.
Attempts now run unscoped, then `--scope user`, then elevated machine
scope, and success is decided by whether the binary is on disk after the
process PATH has been re-read. The four outcomes a user can act on —
declined prompt, installed-but-not-on-PATH, no package source, timeout —
each say so in both languages instead of "安装失败".
Co-Authored-By: Codex <noreply@openai.com>
A file from the file manager arrives through the native drag channel, where wry fixes the macOS drag operation to Copy, so the cursor could never carry the refusal. The answer now lives on the button: it is disabled for the length of the gesture, shows a prohibition sign over its own label, and takes no hover feedback. A Recent row also stops being reported as 'no files' by the native enter, which had lit all three buttons for a file two of them could not serve.
0.1.11 made a dragged row do nothing on every button. The release added to
`dragEnd` landed the gesture immediately, and on macOS the native drop is
reported *after* the button is up: the fallback consumed the gesture with
`dragEnd`'s own position - which Chromium reports as the origin, not as where
the pointer stopped - and the drop that followed was read as a finished
gesture and thrown away. Three buttons, no feedback, on both platforms.
The fallback now waits, and only claims the gesture when it can actually name
a button. A release that aims nowhere stands back, so a real drop that arrives
later still runs, and `landed` keeps the two from both acting. A position of
(0, 0) is treated as no position reported, which is what it is on Chromium, and
answered with the last position the drag moved through.
A row dragged out of the window now carries the file rather than the row. Left
alone the engine photographs whatever is under the pointer, and a Recent row is
a thumbnail, a name, an age, a folder path and five hover buttons - a strip of
the list, which reads as the whole list coming along. The ghost is the file: the
picture the list already decoded, or the extension when there is no picture,
with the name under it, matching the figure the ring draws for a file it is
about to convert.
Rebuilt both 0.1.11 installers from this tree.
A row dragged from Recent onto any of the three buttons did nothing on
Windows, and reported itself as a refusal. Both delivery paths can stay
silent on that platform, so the gesture now ends in `dragEnd`, which always
arrives and carries a point to hit-test.
The two paths are silent for two separate reasons. A Recent row is a real
file drag, and WebView2 registers its own OLE drop target on the window, so
the DOM drop never reaches the page; that target then reads only `CF_HDROP`,
which an in-page drag does not carry, so `enter_is_valid` stays false and the
native `over`/`drop`/`leave` are withheld too. `landed` keeps the fallback an
execution rather than a second one, and a release outside the window runs
nothing, because the hit-test has slack around every button and the row was
meant for Explorer.
An idle ring also stops getting in the way. It is borderless and always on
top, so one left open from a previous drop sits over the buttons; macOS
passes mouse events through its transparent pixels and Windows hands the
gesture to whichever HWND is under the pointer. Starting a row drag now puts
such a ring aside, while a ring owned by an in-flight Shift-drag gesture keeps
waiting for the release that decides its fate.
The availability rule stops being OCR's alone. `lib/dropCapabilities` answers
one question - can this button serve these files - and the button's spent
state, its candidacy while a drag is in flight, and the drop itself all ask
it, so Convert spends for a `.key` the way OCR spends for a PDF, on both
platforms, whichever drag source carried the file. Tools never spends: its
ring ends in Open, Reveal and Send. An unknown payload is not a refusal,
because spending on an empty path list would disable a gesture that works.
Two other reports this round were not about the drag at all:
- A file received over the LAN now reveals itself only when "show results in
Finder" is on, the way a finished conversion already behaves, and a batch
reveals once at its last file rather than once per file.
- Missing runtime components install as one request. Installs run one after
another because the package managers hold a single lock, and one package
answering two rows - Poppler for both PDF rows on Windows - is installed
once. The panel re-reads the machine afterwards either way, since a batch
that stopped at its first failure may have landed everything before it.
Two changes, one goal: the same gesture and the same news should look and read the
same way wherever they happen.
Dropping a file OCR cannot read used to be answered after the fact - the drop ran,
refused, and popped "文字识别仅支持图片格式". The user had to do the wrong thing
first and then be told. Now the decision happens when the drag starts: MainWindow
records the files in flight (`dragPaths`, from the native `enter` payload or from a
Recent row's `dragstart`) and marks the button spent for the whole gesture with
`is-drop-unavailable`, so the refusal is visible before the pointer is committed and
releasing on it is inert and silent. Both drag sources were verified in a production
build, including the reverse case: an image still lights the button and opens the
editor. `over` carries no paths and `dataTransfer` is unreadable during `dragover`,
so the paths have to be registered at the start - a later refactor that reads them
from the move event gets nothing.
The audit that followed found the same class of problem in the messaging, and worse:
the app said one thing three ways.
Prompts were the largest gap. A Rust-authored sentence reached the screen verbatim,
so a Chinese interface answered Convert with `Saved 1 file.`, and macOS's first-run
write-permission failure was one long English line. Rust now names the outcome or the
failure (`outcomeSaved`, `errCaptureBlocked`) and the interface words it; `translate`
still returns an unknown key unchanged, so genuine technical detail - `ffmpeg exited
with status 137` - is reported as it is rather than flattened into a generic line.
`feedback.test.ts` scans the Rust sources and fails on any code without wording in
both languages, and on any outcome the worder does not know; both directions were
checked by breaking them. It also asserts the two dictionaries list identical keys,
which was silently false before.
Durations were arbitrary: the identical share result showed for 2.6s in the ring and
3.6s in the main window, one file's `processing` message lived 12s in one branch and
120s in another, and generic errors used 2200/2400/3000/3200/3800. `FEEDBACK` is now
the only ladder, and `hold` is reserved for tasks that report progress and must not
expire mid-task.
Error text had three normalisation idioms, two inside the same file; `messageFrom()`
is the only one left. Share failures reported twice at once - a banner saying "could
not send" plus a toast naming a different reason - and now report once, in the panel,
with the real reason. The editor's failure notices wore a green check and lasted 1.4s;
a clipboard refusal was silent, and an OCR failure printed into the text box as though
it had been read from the image.
Disabled controls were dimmed at nine different opacities across the app, three
buttons were disabled in JS with no CSS at all, and several `:hover` rules answered a
disabled control. `--dimmed` plus `cursor: default` and `:not(:disabled)` hovers is now
the single treatment, and the OCR drop-target state joins it. Every transient message
is a live region, three unlabeled icon buttons are named, Escape closes the settings
sheet and the first-run panel, the main toast is raised above every sheet of its
window, and nine raw px font sizes went back onto the type ladder.
Out of scope, deliberately: the accent is still ~87 literals rather than one variable,
and the muted warm greys are still written many ways. Both need a visual pass, not a
search and replace.
Four changes to how the main window answers a drag.
The tray row said "识别图片文字…" where the window says 文字识别, and the ellipsis
made it read like a preview rather than a command. It now carries the same words
as the button, in both languages.
OCR refuses a file it cannot read instead of handing it to the format ring. The
fallback was meant to be helpful - "the format ring is more useful than a failing
OCR run" - but from the user's side it looked like the button they dropped on had
ignored their file and opened something else. A drop on OCR is now either a read
or a refusal that names the reason.
Dragging an outside file and dragging a Recent row are now the same interaction.
The panel used to scale, recolour and swap its heading when a file entered the
window from Finder, while a row dragged from the list did none of that, because
an in-webview drag raises no native drag events. The panel no longer animates at
all: the is-dragging class, its two rules, and the transition they drove are
gone, and feedback lives only on the three buttons, which both paths already
share.
Releasing off a button no longer pops the toast. 0.1.9 added it to explain why
nothing had run, but it fired at the pointer, in a place the user had not chosen
to aim at, and the buttons already show where a drop lands. Off a button,
nothing happens, silently, on both paths.
The version comparison test gains the patch-component case: 0.1.10 is the first
release whose patch number reaches two digits, and the rule was only asserted for
the minor position.
Three changes to the main window, requested together.
A file drop is now aimed. The three buttons are the only drop targets and the
button you release on is the action it runs; a release anywhere else on the
panel runs nothing and says so, instead of opening an action ring nobody asked
for. This replaces the old fallback in both delivery paths - the DOM handler and
the native webview drop - because two routes to the same gesture must not have
two different rules. dropFiles therefore takes a required action rather than an
optional one, and the actions ring is still reachable from the Shift-drag
gesture and from a file type with no convertible formats.
Recent rows can be dragged back onto those buttons. A row leaves Shift as a real
file drag, so one gesture can be reported twice, once by the DOM and once by the
native events, and which arrives first depends on the engine; recentDrag.landed
lets only the first through. The hint under the buttons names the affordance,
which is otherwise invisible, and all three buttons light up as candidates for as
long as any drag is in flight - a native one via dragging, an internal one via
rowDragging, since a row drag inside the webview does not raise native events.
Type sizes are on one ladder now (--text-3xs to --text-hero) instead of being
invented per rule, which is how the settings drawer drifted down to 7-8px. 92
declarations under 12px became one. The drawer is wider, its tabs are pills, and
the runtime, share, setup and radial surfaces moved onto the same scale.
The capture-behaviour setting is removed: the CaptureAfter enum, its field, its
command and its UI. A finished capture always shows the result card, falling back
to the editor when a card window cannot be created. Stored settings that still
carry captureAfter load unchanged, because the struct does not deny unknown
fields.
Also dropped 23 i18n keys no surface used, one dead re-export in history.ts, and
a stale .home-drop p rule that was outranking the new hint and sizing it as body
copy. tsconfig now turns on noUnusedLocals, noUnusedParameters and
noFallthroughCasesInSwitch, which is what keeps the dead imports from coming
back; the tree already passes all three.
The row under a verified download took both controls from the Runtime tab, where
rows are dense: .runtime-install is 27px tall at 8.5px text and .settings-link is
a bare 8.5px text link with no box at all. In the Updates panel, whose own status
text, artifact chip and version pill are 12px, that produced an orange pill beside
floating text - the pair did not look like one choice, and the text link did not
read as a button you could press.
They get their own .update-action now, sized to the 12px scale the panel already
uses, and both take the same box so the eye groups them. The commit variant wears
the app's existing primary gradient, so the action that does something is the loud
one and Discard stays the quiet alternative.
"放弃" also stops competing at the moment it stops meaning anything: once the
handoff script is written the app is counting down to exit, so the row collapses
to the single control still in play. update_clear only resets the status, so this
is presentation, not a saved deletion.
updateInstalling was a whole sentence inside a fixed-height pill, which is what
made that button stretch unevenly against its neighbour. It is "正在安装…" now;
the panel's own closing paragraph already says Shift will restart and interrupt a
running conversion, so the button does not have to repeat it.
The Updates tab drops the "installs the ... artifact" chip, and the state label
now leads the status row instead of floating right, since the version it used to
sit beside moved into the header.
The file list no longer disappears on upgrade:
- The library already lived in the app data directory, outside the bundle, so an
in-app update or reinstall never touched `history.json`. What it never had was a
bridge from the store 0.1 used: that list lived in the webview's own storage,
which a reinstall does not survive, so the first launch of a newer build showed
an empty Recent list over files that were all still on disk.
- `history_import` merges those rows once, on the first launch after an upgrade.
An entry the library already lists keeps its own timestamp, the kind is
re-derived from the file rather than taken from the older store's guess, and the
legacy key is dropped only after the merge succeeds so a later upgrade cannot
resurrect rows the user has since removed.
- `HistoryEntry.kind`/`.at` gained serde defaults, so a row from the older store
degrades to a usable entry instead of failing the whole import.
Verified on this machine that the legacy `shift.recent` key is still present in the
installed app's webview store, so the import has rows to adopt.
Gates: cargo fmt --check clean, `cargo test --lib` 149 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 38 passed, `pnpm build` ok.
Updates now finish without leaving the app. After the SHA256 gate, macOS replaces
its own `.app` from the downloaded disk image and Windows runs the same NSIS
installer with `/S`; both from a detached helper that waits for this process to
exit and then opens the new copy.
- `update.rs`: `bundle_path` (is this a bundled run?), `can_replace` (is the
enclosing folder writable — checked before quitting, not after), and the two
handoff scripts. Every macOS failure path still `open`s the bundle it had, so a
failed swap leaves Shift running rather than closed.
- `windows-installer.nsi`: `${Silent}` skips the "Shift is running, close it?"
box, which would otherwise abort an update nobody is there to answer.
- `useUpdate.ts`: a failed install reports its own error and keeps the verified
download, instead of downgrading a "ready" status to "error".
The Updates tab now leads with two lines above everything else: system,
architecture and running version, then the feed URL. The header no longer repeats
the version in the status row.
Verified end to end on macOS: a 0.1.1 bundle swapped by the published 0.1.2 image,
`codesign --verify --deep --strict` clean afterwards, image detached, and the
busy-image path shown to reopen the old copy.
Gates: cargo fmt --check clean, `cargo test --lib` 146 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 34 passed, `pnpm build` ok.
Update path
- `src-tauri/src/update.rs`: manifest fetch, semver compare, optional ed25519
signature check against a key baked in at build time, then a size + SHA256
gate before an installer can run. `UpdateStatus` now reports the artifact key
it resolved so the UI can name what it will install.
- Settings → Updates panel shows the feed, the check/download state machine, and
the local OS, architecture and release artifact for this machine.
- `scripts/publish-release.sh` + `scripts/release-key.py` publish installers and a
signed `shift-update.json` onto an orphan `releases` branch.
Scope trims requested for this release
- Settings: the Radial rings tab is gone, so ring orders are read from
`settings.json` with no in-app editor for now.
- Main window: the update entry in the header bar is gone; updates live in
Settings → Updates only.
- Release targets are macOS universal and Windows x64. ARM64 and Linux stay
buildable and are no longer published; `docs/RELEASE.md` records the decision.
Gates: cargo fmt --check clean, `cargo test --lib` 142 passed / 2 ignored,
`pnpm check` clean, `pnpm test` 34 passed, `pnpm build` ok.