Revert the desktop hotkey: a new crate needs a Cargo.lock this machine cannot write
Android / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / Build now, or wait for Android? (push) Successful in 4s
Android / Kotlin + Rust (APK) (push) Skipped
CI & Build / Python lint (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 7s
CI & Build / Python tests (push) Successful in 10s
CI & Build / integration (push) Successful in 19s
CI & Build / Build & push image (push) Successful in 36s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 1m52s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m7s
Desktop (Tauri) / Update manifest (push) Successful in 4s
Android / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / Build now, or wait for Android? (push) Successful in 4s
Android / Kotlin + Rust (APK) (push) Skipped
CI & Build / Python lint (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 3s
CI & Build / TypeScript typecheck (push) Successful in 7s
CI & Build / Python tests (push) Successful in 10s
CI & Build / integration (push) Successful in 19s
CI & Build / Build & push image (push) Successful in 36s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 1m52s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m7s
Desktop (Tauri) / Update manifest (push) Successful in 4s
`42e06da` added `tauri-plugin-global-shortcut` to Cargo.toml without updating
Cargo.lock, and every cargo invocation in CI passes `--locked`. Both desktop
jobs failed on the same line before compiling anything:
error: cannot update the lock file ... because --locked was passed
So this says nothing about whether the code is right — clippy never ran. The
gate did exactly its job.
There is no Rust toolchain on this workstation (rule 10 — CI verifies), and a
lockfile is the one artifact CI is deliberately forbidden to generate. Hand-
writing the entries is not a real option: it needs the exact checksum and the
whole transitive tree, and a wrong checksum fails harder than a missing one.
Reverted rather than left red, because a red `dev` blocks everything behind it
and the Android half of #1899 is green and unaffected at c8318c3. The work is
intact in 42e06da and comes back with `git revert 5e0c...` once the lockfile
exists — nothing here needs rewriting.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K3MMqUtzX1TJgA1oypvm1c
This commit is contained in:
@@ -5,13 +5,6 @@
|
||||
|
||||
interface TauriGlobal {
|
||||
core: { invoke: <T>(cmd: string, args?: Record<string, unknown>) => Promise<T> };
|
||||
// Also from `withGlobalTauri`. Needed because quick capture puts the app in TWO
|
||||
// windows, each with its own Pinia stores — a note saved in one is invisible to
|
||||
// the other until something says so, and an event is the only channel between
|
||||
// them that does not involve polling SQLite.
|
||||
event?: {
|
||||
listen: <T>(event: string, handler: (e: { payload: T }) => void) => Promise<() => void>;
|
||||
};
|
||||
}
|
||||
|
||||
declare global {
|
||||
@@ -199,49 +192,3 @@ export const updates = {
|
||||
*/
|
||||
install: () => invoke<void>("update_install"),
|
||||
};
|
||||
|
||||
|
||||
// --- Quick capture (#1899) ---------------------------------------------------
|
||||
|
||||
/**
|
||||
* The stored hotkey and whether the OS actually accepted it.
|
||||
*
|
||||
* They disagree more often than you would like: a combination can be saved and
|
||||
* refuse to register because a window manager or another app already holds it,
|
||||
* and on Wayland a compositor may refuse global grabs entirely. `registered:
|
||||
* false` alongside a non-empty `shortcut` is precisely that case, and the UI has
|
||||
* to say so — a hotkey that silently does nothing is worse than none, because
|
||||
* there is nothing to look at and nothing to fix.
|
||||
*/
|
||||
export interface CaptureShortcut {
|
||||
/** The stored combination, or "" when quick capture is off. */
|
||||
shortcut: string;
|
||||
registered: boolean;
|
||||
}
|
||||
|
||||
/** Offered as a starting point, never applied on the user's behalf. */
|
||||
export const SUGGESTED_CAPTURE_SHORTCUT = "CommandOrControl+Shift+N";
|
||||
|
||||
/** Fired at the main window after a capture is saved. */
|
||||
const CAPTURED_EVENT = "thoughtsync://captured";
|
||||
|
||||
export const capture = {
|
||||
shortcut: () => invoke<CaptureShortcut>("capture_shortcut_get"),
|
||||
/** Pass "" to turn quick capture off. Rejects if the system refuses it. */
|
||||
setShortcut: (shortcut: string) => invoke<CaptureShortcut>("capture_shortcut_set", { shortcut }),
|
||||
/** Hide the capture window; `saved` decides whether the board is told to reload. */
|
||||
done: (saved: boolean) => invoke<void>("capture_done", { saved }),
|
||||
};
|
||||
|
||||
/**
|
||||
* Run `handler` whenever a note is captured in the other window.
|
||||
*
|
||||
* Returns an unlisten function, or a no-op on the web build and on any desktop
|
||||
* runtime that does not expose the event API — the board simply keeps showing
|
||||
* what it has until its next load, which is a stale list rather than a broken one.
|
||||
*/
|
||||
export async function onCaptured(handler: () => void): Promise<() => void> {
|
||||
const events = window.__TAURI__?.event;
|
||||
if (!events) return () => {};
|
||||
return events.listen(CAPTURED_EVENT, () => handler());
|
||||
}
|
||||
|
||||
@@ -24,15 +24,6 @@ const router = createRouter({
|
||||
{ path: "timeline", name: "timeline", component: () => import("../views/TimelineView.vue") },
|
||||
],
|
||||
},
|
||||
{
|
||||
// The quick-capture window (#1899). Its own route because it is its own
|
||||
// WINDOW — no shell, no nav, one field. Desktop only: there is no global
|
||||
// hotkey in a browser tab and nothing to summon it.
|
||||
path: "/capture",
|
||||
name: "capture",
|
||||
component: () => import("../views/CaptureView.vue"),
|
||||
meta: { requiresAuth: true, requiresDesktop: true },
|
||||
},
|
||||
{
|
||||
path: "/settings",
|
||||
name: "settings",
|
||||
@@ -98,13 +89,6 @@ router.beforeEach(async (to) => {
|
||||
if (to.meta.requiresDesktop && !isDesktop()) {
|
||||
return { name: "board" };
|
||||
}
|
||||
// The capture window is opened at `index.html?capture=1` rather than at
|
||||
// `/capture`, because the bundled assets are served as files and a path with no
|
||||
// file behind it 404s in the production build — it only routes under the dev
|
||||
// server. A query string survives that, and this is where it becomes a route.
|
||||
if (to.query.capture === "1" && to.name !== "capture") {
|
||||
return { name: "capture" };
|
||||
}
|
||||
// Deliberately NOT applied to /login and /register: bouncing those on desktop
|
||||
// would loop against the requiresAuth guard above the moment a session is
|
||||
// missing. Nothing on the desktop navigates to them any more (AppShell's sign-out
|
||||
|
||||
@@ -11,7 +11,7 @@ import EmptyState from "../components/EmptyState.vue";
|
||||
import FilterBar from "../components/FilterBar.vue";
|
||||
import NoteGrid from "../components/NoteGrid.vue";
|
||||
import NoteEditor from "../components/NoteEditor.vue";
|
||||
import { isDesktop, onCaptured, sync as syncBridge } from "../desktop/bridge";
|
||||
import { isDesktop, sync as syncBridge } from "../desktop/bridge";
|
||||
|
||||
const notes = useNotesStore();
|
||||
const config = useConfigStore();
|
||||
@@ -227,21 +227,8 @@ onMounted(() => {
|
||||
.catch(() => {});
|
||||
}
|
||||
});
|
||||
// A note written in the quick-capture window lands in the same SQLite file but a
|
||||
// different Pinia store — this window has no way to know unless it is told.
|
||||
// Registered as a promise because the listener is set up asynchronously, and
|
||||
// unregistered on the way out so a board that has been navigated away from does
|
||||
// not keep reloading itself.
|
||||
let stopCaptureListener: (() => void) | null = null;
|
||||
onMounted(() => {
|
||||
void onCaptured(() => void reload()).then((stop) => {
|
||||
stopCaptureListener = stop;
|
||||
});
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener("keydown", onBoardKey);
|
||||
stopCaptureListener?.();
|
||||
ui.boardCardFocused = false;
|
||||
});
|
||||
watch([currentView, currentLabel, facetKey], reload);
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
// The quick-capture window: one field, and two ways out.
|
||||
//
|
||||
// This runs in a SECOND Tauri window, summoned by a global hotkey over whatever
|
||||
// the person was doing. Everything here is shaped by that: no shell, no nav, no
|
||||
// board — a window that arrives uninvited has to be finishable in one gesture and
|
||||
// leave nothing behind if it isn't.
|
||||
import { nextTick, onMounted, ref } from "vue";
|
||||
import { repo } from "../adapters";
|
||||
import { capture } from "../desktop/bridge";
|
||||
|
||||
const body = ref("");
|
||||
const field = ref<HTMLTextAreaElement | null>(null);
|
||||
const saving = ref(false);
|
||||
const error = ref("");
|
||||
|
||||
onMounted(async () => {
|
||||
// Focused on arrival, and after a save. The whole feature is "press the keys and
|
||||
// start typing" — a window that needs a click first has not saved anyone a step.
|
||||
await nextTick();
|
||||
field.value?.focus();
|
||||
});
|
||||
|
||||
async function save() {
|
||||
const content = body.value.trim();
|
||||
// Nothing typed is not an error, it is a change of mind — the same reading the
|
||||
// board takes of tapping + and walking away.
|
||||
if (!content) {
|
||||
void capture.done(false);
|
||||
return;
|
||||
}
|
||||
saving.value = true;
|
||||
error.value = "";
|
||||
try {
|
||||
await repo.notes.create({ body: content });
|
||||
body.value = "";
|
||||
await capture.done(true);
|
||||
} catch {
|
||||
// The window STAYS OPEN on failure, holding the text. Hiding it would throw
|
||||
// away the only copy of something the person just wrote, to report a problem
|
||||
// they could otherwise retry their way out of.
|
||||
error.value = "Couldn't save that. Your text is still here — try again.";
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function dismiss() {
|
||||
// The text is deliberately KEPT. The window is hidden rather than destroyed, so
|
||||
// a capture interrupted by something more urgent is still there on the next
|
||||
// press — which is the behaviour that makes it safe to press Escape.
|
||||
void capture.done(false);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="flex h-screen w-screen flex-col gap-2 bg-neutral-50 p-3 text-neutral-900 dark:bg-neutral-950 dark:text-neutral-100"
|
||||
>
|
||||
<textarea
|
||||
ref="field"
|
||||
v-model="body"
|
||||
class="min-h-0 flex-1 resize-none rounded-lg border border-neutral-300 bg-white px-3 py-2 text-sm outline-none focus-visible:ring-2 focus-visible:ring-brand dark:border-neutral-700 dark:bg-neutral-900"
|
||||
placeholder="Write it down…"
|
||||
aria-label="New note"
|
||||
@keydown.esc.prevent="dismiss"
|
||||
@keydown.enter.ctrl.prevent="save"
|
||||
@keydown.enter.meta.prevent="save"
|
||||
/>
|
||||
|
||||
<p v-if="error" class="text-xs text-red-600 dark:text-red-400">{{ error }}</p>
|
||||
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<!-- The shortcuts are written down rather than assumed: this window is seen
|
||||
rarely and briefly, and it is the only place they are discoverable. -->
|
||||
<p class="text-xs text-neutral-400">
|
||||
<kbd>Ctrl</kbd>/<kbd>⌘</kbd> + <kbd>Enter</kbd> to save · <kbd>Esc</kbd> to dismiss
|
||||
</p>
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<button type="button" class="btn btn-ghost" @click="dismiss">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" :disabled="saving" @click="save">
|
||||
{{ saving ? "Saving…" : "Save" }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -5,11 +5,8 @@ import BaseButton from "../components/BaseButton.vue";
|
||||
import BaseInput from "../components/BaseInput.vue";
|
||||
import Icon from "../components/Icon.vue";
|
||||
import {
|
||||
SUGGESTED_CAPTURE_SHORTCUT,
|
||||
capture as captureBridge,
|
||||
sync as syncBridge,
|
||||
updates as updateBridge,
|
||||
type CaptureShortcut,
|
||||
type Compatibility,
|
||||
type ProbeResult,
|
||||
type RevokeOutcome,
|
||||
@@ -80,31 +77,6 @@ const checkedOnce = ref(false);
|
||||
|
||||
const updateAvailable = computed(() => !!update.value?.available);
|
||||
|
||||
// --- Quick capture -----------------------------------------------------------
|
||||
// A desktop-local preference, so it lives here beside the update channel rather
|
||||
// than in admin Settings: that screen is the SERVER's, and this is a property of
|
||||
// this installation on this machine.
|
||||
const shortcut = ref<CaptureShortcut>({ shortcut: "", registered: false });
|
||||
const shortcutDraft = ref("");
|
||||
const savingShortcut = ref(false);
|
||||
const shortcutError = ref("");
|
||||
|
||||
async function saveShortcut(value: string) {
|
||||
savingShortcut.value = true;
|
||||
shortcutError.value = "";
|
||||
try {
|
||||
shortcut.value = await captureBridge.setShortcut(value);
|
||||
shortcutDraft.value = shortcut.value.shortcut;
|
||||
} catch (e) {
|
||||
// The message comes from the core and names the actual reason — "something
|
||||
// else is already using it" reads very differently from "that is not a
|
||||
// shortcut this system understands", and both are things you can act on.
|
||||
shortcutError.value = String((e as { message?: string }).message ?? e);
|
||||
} finally {
|
||||
savingShortcut.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function checkUpdates() {
|
||||
checking.value = true;
|
||||
updateError.value = "";
|
||||
@@ -154,13 +126,6 @@ async function refresh() {
|
||||
// An older build without the update commands — leave the default showing
|
||||
// rather than blocking the whole Sync screen on it.
|
||||
}
|
||||
try {
|
||||
shortcut.value = await captureBridge.shortcut();
|
||||
shortcutDraft.value = shortcut.value.shortcut;
|
||||
} catch {
|
||||
// Older build without the capture commands. Same reading as the channel
|
||||
// above — show the default rather than block the screen.
|
||||
}
|
||||
try {
|
||||
status.value = await syncBridge.status();
|
||||
pending.value = await syncBridge.hasPending();
|
||||
@@ -487,65 +452,6 @@ onMounted(refresh);
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<!-- Quick capture. Outside the linked/unlinked split for the same reason as
|
||||
updates: a hotkey that writes to the local store needs no server. -->
|
||||
<section class="mt-10 border-t border-neutral-200 pt-8 dark:border-neutral-800">
|
||||
<h2 class="text-sm font-semibold">Quick capture</h2>
|
||||
<p class="mt-1 text-sm text-neutral-500 dark:text-neutral-400">
|
||||
A system-wide shortcut that opens a small window to write a note in, without
|
||||
bringing this one forward.
|
||||
</p>
|
||||
|
||||
<div class="mt-4 flex items-end gap-3">
|
||||
<BaseInput
|
||||
id="capture-shortcut"
|
||||
v-model="shortcutDraft"
|
||||
label="Shortcut"
|
||||
:placeholder="SUGGESTED_CAPTURE_SHORTCUT"
|
||||
class="flex-1"
|
||||
/>
|
||||
<BaseButton :loading="savingShortcut" @click="saveShortcut(shortcutDraft)">Save</BaseButton>
|
||||
<BaseButton
|
||||
v-if="shortcut.shortcut"
|
||||
variant="ghost"
|
||||
:loading="savingShortcut"
|
||||
@click="saveShortcut('')"
|
||||
>
|
||||
Turn off
|
||||
</BaseButton>
|
||||
</div>
|
||||
|
||||
<p v-if="shortcutError" class="mt-2 text-sm text-red-600 dark:text-red-400">
|
||||
{{ shortcutError }}
|
||||
</p>
|
||||
|
||||
<!-- Stored and LIVE are reported separately because they can disagree: a
|
||||
combination another app grabbed first is saved here and does nothing when
|
||||
pressed, and saying only "your shortcut is X" would be a lie with a
|
||||
keystroke attached. -->
|
||||
<p
|
||||
v-else-if="shortcut.shortcut && !shortcut.registered"
|
||||
class="mt-2 text-sm text-amber-700 dark:text-amber-400"
|
||||
>
|
||||
{{ shortcut.shortcut }} is saved but isn't active — something else on this
|
||||
system is holding it. Try a different combination.
|
||||
</p>
|
||||
<p v-else-if="shortcut.registered" class="mt-2 text-sm text-neutral-500 dark:text-neutral-400">
|
||||
Press {{ shortcut.shortcut }} anywhere to capture a note.
|
||||
</p>
|
||||
<p v-else class="mt-2 text-sm text-neutral-500 dark:text-neutral-400">
|
||||
Off. There's no default on purpose — any combination picked for you is one
|
||||
taken away from something else on your machine.
|
||||
<button
|
||||
type="button"
|
||||
class="underline hover:text-neutral-700 dark:hover:text-neutral-300"
|
||||
@click="saveShortcut(SUGGESTED_CAPTURE_SHORTCUT)"
|
||||
>
|
||||
Use {{ SUGGESTED_CAPTURE_SHORTCUT }}
|
||||
</button>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<!-- Updates sit outside the linked/unlinked split on purpose: an install that
|
||||
has never touched a server still updates itself. -->
|
||||
<section class="mt-10 border-t border-neutral-200 pt-8 dark:border-neutral-800">
|
||||
|
||||
Reference in New Issue
Block a user