From 16c3552be6aabc6ba6e680a7ad644df85e856030 Mon Sep 17 00:00:00 2001 From: Benjamin Hardy Date: Thu, 15 Oct 2026 16:36:10 +0200 Subject: [PATCH] Changed option keyboard shortcuts to use command instead --- CLAUDE.md | 8 ++--- frontend/src/components/MainWaveform.tsx | 9 +++--- frontend/src/components/ShortcutsDialog.tsx | 6 ++-- frontend/src/components/Sidebar.tsx | 16 +++++----- frontend/src/components/TrackTable.tsx | 9 ++++-- frontend/src/lib/addTracks.ts | 2 +- frontend/src/lib/drag.tsx | 33 +++++++++++---------- frontend/src/lib/modKey.ts | 15 ++++++++++ frontend/src/lib/shortcuts.ts | 30 +++++++++---------- 9 files changed, 72 insertions(+), 56 deletions(-) create mode 100644 frontend/src/lib/modKey.ts diff --git a/CLAUDE.md b/CLAUDE.md index 73d8bfb..5ba50d4 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -870,7 +870,7 @@ Two independent apps that talk over HTTP: too, so nested playlists are reachable). Tracks dropped on a playlist go through `lib/addTracks.ts` — shared with the context menu's "Add to" — which ASKS about duplicates where the platform can hold them (decided: - ask each time), and Option/Alt moves them out of the editable playlist + ask each time), and Cmd (Ctrl on Windows; `lib/modKey.ts`) moves them out of the editable playlist they came from. A device's or Files folder's tracks open `ImportDialog` (`trackIds` + `target`) / `AddFilesDialog` with the target filled in (`onAddForeign`), so copy-vs-reference is still asked. Export rows take the @@ -893,7 +893,7 @@ Two independent apps that talk over HTTP: / Try again (`backend_restart`). The shell has no timeout of its own. Before ready it answers quit requests itself — nothing can be unsaved — and stops at ready so it never races `QuitGuard`), `SaveBar` (+ "Discard changes…" when - dirty, and the settings gear beside it, whose menu (or `?` anywhere) opens `ShortcutsDialog` — a KEYBOARD MAP (decided 2026-10-15): keys lit in the colour of what they do, a caption explaining the key pointed at or pressed (pressing explains, it never acts: a capture-phase listener keeps the deck's and table's keys from firing), holding or picking ⇧ / Cmd-Ctrl / Alt relights it with that layer, mouse gestures listed beneath. It shrinks to fit the dialog and drops the words on the keys when too small. Its content is `lib/shortcuts.ts`, written out BY HAND, so a new or changed shortcut in `PrepStrip` / `TrackTable` must be added there too — and `AppSettings` ("Konduktor Settings…": app-level prefs, each with its default in `APP_SETTING_DEFAULTS` and read through `useAppSetting`; today `expandPlaylistFolders` and `exportRootFolder`, both default off — the latter read by the backend at `run_export` and passed down as `ExportPayload.root_folder`. The Sidebar holds folder open state as per-id overrides of that setting, reset on a new library or a change of the setting, and carried to the new ids when a rename/move changes a folder's path id)), `Toolbar` (search/filters; columns are chosen by right-clicking the table header), + dirty, and the settings gear beside it, whose menu (or `?` anywhere) opens `ShortcutsDialog` — a KEYBOARD MAP (decided 2026-10-15): keys lit in the colour of what they do, a caption explaining the key pointed at or pressed (pressing explains, it never acts: a capture-phase listener keeps the deck's and table's keys from firing), holding or picking ⇧ / Cmd-Ctrl relights it with that layer, mouse gestures listed beneath. It shrinks to fit the dialog and drops the words on the keys when too small. Its content is `lib/shortcuts.ts`, written out BY HAND, so a new or changed shortcut in `PrepStrip` / `TrackTable` must be added there too — and `AppSettings` ("Konduktor Settings…": app-level prefs, each with its default in `APP_SETTING_DEFAULTS` and read through `useAppSetting`; today `expandPlaylistFolders` and `exportRootFolder`, both default off — the latter read by the backend at `run_export` and passed down as `ExportPayload.root_folder`. The Sidebar holds folder open state as per-id overrides of that setting, reset on a new library or a change of the setting, and carried to the new ids when a rename/move changes a folder's path id)), `Toolbar` (search/filters; columns are chosen by right-clicking the table header), `TrackTable` (**the one track list** — All Tracks, playlists, exports and devices. TanStack Table + **virtualized** grid; per-row play button, configurable columns, header sorting, inline double-click editing, and @@ -915,7 +915,7 @@ Two independent apps that talk over HTTP: pointer-y / ROW_HEIGHT. dnd-kit still reorders the header's columns. Every table's rows are a DRAG SOURCE through `lib/drag.tsx` (a selected row carries the selection, the payload's `lead` is the row grabbed, `dragFrom` - says whose ids they are and which editable playlist an Option-drag leaves); + says whose ids they are and which editable playlist a Cmd/Ctrl-drag leaves — a Cmd/Ctrl press arms a drag, and stays a toggle-click if it never moves); the in-table reorder is just the table's own drop target.) **`lib/drag.tsx` — drag and drop across the window** (decided 2026-10-06, [the discussion](.claude/discussions/discuss-drag-and-drop-2026-10-06.md)): @@ -1029,7 +1029,7 @@ Two independent apps that talk over HTTP: one amplitude lane per stem, each normalised to its own 99.5th percentile but never below 5% of the loudest (a silent stem stays silent). `MainWaveform` draws the lanes in the file's own colours with a mute - button at each lane's left edge (click = mute, Alt/Option-click = solo); + button at each lane's left edge (click = mute, Cmd/Ctrl-click = solo); Q W E R mute stems 1-4, Shift+ solos. **Solo is not a mode**: it SETS the mutes (every other stem muted), so each stem stays freely mutable after it; soloing the one stem still playing unmutes all. Mutes reset per track. Memory is diff --git a/frontend/src/components/MainWaveform.tsx b/frontend/src/components/MainWaveform.tsx index c889449..43db165 100644 --- a/frontend/src/components/MainWaveform.tsx +++ b/frontend/src/components/MainWaveform.tsx @@ -2,6 +2,7 @@ import { useEffect, useRef } from 'react' import type { CuePoint } from '../api' import type { BeatGrid } from '../lib/beatgrid' import { Icon } from '../lib/icons' +import { hasMod, MOD_NAME } from '../lib/modKey' import { drawBeatgrid, drawCuePoint, drawCues, drawLoop, drawLoopIn, drawPlayhead } from '../lib/cues' import { laneScales, makeSpans, paintRaw, rawSpans, tintAt, type RawWave } from '../lib/rawWave' import { paintLane, paintWave, type WaveColumn } from '../lib/waveform' @@ -38,7 +39,7 @@ interface Props { onScratchEnd: (t: number) => void /** A stem track: one lane per stem instead of the three-band mix view. */ lanes?: StemLane[] | null - /** Click = mute toggle; Alt/Option-click = solo (mute all the others). */ + /** Click = mute toggle; Cmd/Ctrl-click = solo (mute all the others). */ onStemToggle?: (index: number, solo: boolean) => void } @@ -56,8 +57,6 @@ export interface StemLane { shortcut: string } -const ALT = typeof navigator !== 'undefined' && /Mac/.test(navigator.platform) ? 'Option' : 'Alt' - const DRAG_THRESHOLD = 3 // px before a press becomes a scratch (vs a click-seek) export const MIN_SEC = 0.25 // most zoomed-in (seconds across the view): a kick's attack spans dozens of px @@ -277,8 +276,8 @@ export function MainWaveform({