Skip to content

Settings and Shell

Pablo Martínez López edited this page Nov 28, 2026 · 38 revisions

Settings and Shell

English · Español

The shell is the frame of the app: the top bar (view switcher, deck name, save indicator, update button, help button, Settings button), the three resizable panels of the deck view, and the boot hooks that open the last deck and start autosave. The Settings dialog holds interface language, in-app updates, the optional multilingual-names index and the whole appearance system. This page documents both, what each setting does and where it is persisted.

Code: src/features/shell/ and src/features/settings/.

Shell (src/features/shell/)

File Responsibility
app-shell.tsx AppShell: header + main area; DeckName (inline deck-name input); mounts <Tutorial /> and calls useInitialTutorial() (Tutorials); mounts <ConfirmClose />; changeView asks before leaving Design with an unsaved card (below); useIncomingLinks (src/features/friends/links.ts) switches to Play when a game link tapete://unirse/<code> (or proxybuilder://unirse/<code>) arrives and is accepted (it is refused with a toast while a game is running; Online Play), and opens "Friends" with the code filled in for a tapete://amigo/<code> link (Friends and Messages).
scroll-per-view.ts useScrollPerView(view, root): remembers the scroll of each view and puts it back when returning (below).
confirm-close.tsx ConfirmClose: the guard that asks before the window closes when something would be lost (below).
use-initial-deck.ts useInitialDeck(): boot of deck, autosave, plan, undo/redo keys.
save-indicator.tsx SaveIndicator: "Saved / Saving... / Unsaved / Couldn't save" (the last one is a button that retries). compact (phone): only the icon; the text stays for the screen reader.
auto-update.tsx Auto-update loop, update toasts, UpdateButton, UpdateDot, useSettingsNotice.
mobile-bar.tsx MobileBottomBar (the phone's bottom tab bar) and MoreSheet (the "More" sheet, a MenuSheet of MenuRows; the update dot is the Settings row's mark): see "The shell by format".
shell-back.ts The shell's Android back actions: backDestination (from Design back goes to Deck), defaultBackAction and createDoubleTapExit ("Press again to leave").
table-fullscreen.ts useTableFullscreen() (a game open on a phone hides the shell bars) and leaveTable() (back to the screen the user came from; the game stays open).
window-controls.tsx WindowControls: minimize, exit full screen and close, at the end of the top bar, only while the window is full screen (below).

Top bar (AppShell header, 48 px high)

Left to right:

  1. Logo and title: <Logo> (src/components/logo.tsx: the hand playing a card, Iconify game-icons:card-play, on the felt-green rounded square, the same as the app icon and the website; its felt takes the theme's primary colour (and the taskbar icon follows it, see below); the icon is CC BY 3.0, so the Settings dialog header credits it under the description: "Logo and game icons: game-icons.net (CC BY 3.0)", which also covers the other game-icons:* icons of the interface, and so do the READMEs) and "Tapete" (the visible name since 4.0.0), subtitle with the tagline "A place for every player" (the README's); the subtitle is hidden below the lg breakpoint so a narrow window keeps room for the deck name).
  2. A single-select ToggleGroup bound to useUi().view: Deck, Design, Library, Search (see Card-Search), Play (lucide:swords icon, the game table). Only these five values are accepted by onValueChange (clicking the active item returns an empty value that is ignored, so one is always selected).
  3. DeckName (hidden in the Library and Play views): an Input that edits deck.name. Commit on blur or Enter, Escape reverts; an empty value reverts; changes go through useDeck.setWithoutHistory({ name }) (saved, not undoable). It is 16 rem wide but may shrink down to 6 rem (min-w-24 shrink) in a narrow window.
  4. Right side: SaveIndicator, UpdateButton, the help button (ghost icon button with lucide:circle-help, tooltip and aria-label "Tutorial for this screen"; it calls useUi().openTutorial(view) for the current screen, see Tutorials) and the Settings button (below lg only its icon; the tooltip then says "Settings" unless it carries the update notice).
  5. At the far end, only while the window is full screen: WindowControls (minimize, exit full screen, close). See "Full screen (F11) and window controls".

Several of these elements carry a data-tutorial attribute (tabs, deck-name, help, settings): they are the anchors the deck tour outlines.

SaveIndicator reads useDeck().saved / saveError; it renders nothing until a deck is open. On error the label becomes a small button that calls saveNow() again, with a tooltip of message(error) plus "Click to retry.": a failed autosave (a full disk, a locked database) can be retried on the spot instead of waiting for the next change.

Main area

view === "deck": ResizablePanelGroup horizontal with left (decklist, default 22 %, min 260 px), center (preview, min 360 px), right (export, default 22 %, min 260 px) and two handles with grips. Sizes persist in localStorage["proxybuilder.paneles"] through useDefaultLayout. The other views are a plain switch on view: design, search, table and, for anything else, library render the screen App passes in. table is TableScreen (src/features/table/table-screen.tsx, Game Table): it asks Rust table_state once and, until then, renders nothing; with no game open it shows the entrance TableEntry, otherwise the table. Leaving the tab keeps the game open in Rust and saves it (save() on unmount); coming back picks it up as it was.

The entrance (src/features/table/entry.tsx) has the deck list of the library (search box, "History" of finished games, the most recently opened deck preselected), the "Unfinished game" card when a saved game exists ("Resume the game" / "Discard"), the player name, format, list to play (required in Commander when the deck has more than 100 cards), lives, mulligan, the turn helps, the sparring intensity and "This deck's playmat…", and four ways to start: "Solo" (asks first if it would replace the saved game, as does starting a local game), "With friends…" (opens "Friends", Friends and Messages), "Local game…" and "Online…" ("Online…" turns into "Back to the online game" while an online game is open). The options scroll on their own and the start buttons stay fixed below; a disabled start button says why in its tooltip. The window minimum is 960 x 640 and the default 1440 x 900 (src-tauri/tauri.conf.json).

The shell by format

AppShell reads useFormFactor() (Mobile) and renders one of three arrangements of the same screens. Desktop is exactly the layout described above.

Format Arrangement
Desktop Header with the five-screen toggle and three resizable panels in Deck.
Tablet with touch (size === "tablet" && touch) Compact header (the title and button texts shrink), two panes in Deck (list and sheets; their widths persist under proxybuilder.paneles-tableta) and Export in a side sheet (Sheet) opened by an "Export" button in the header. A narrow desktop window with a mouse stays on the desktop layout, because the tablet arrangement is for the finger, not for room.
Phone A 3 rem header with the shape of TopBar (the deck name as an editable field and the save indicator as an icon, SaveIndicator compact; only in Deck), the screen, and a bottom tab bar (MobileBottomBar): Deck, Design, Library, Search, Play and "More". On its side, the bar is a rail on the left (side) and Deck's tabs go inside the header. Deck is split into three tabs (List, Sheets, Export). "More" opens a sheet with Settings, the tutorial of the current screen and the update button, plus the update notice if there is one.

Details that explain the choices:

  • The root height in touch is min(100%, var(--visible-height, 100dvh) - env(safe-area-inset-top)): #root already pads the safe areas (0 on Android, where the app is always full screen and the activity leaves out the notch; see Mobile), and with the keyboard open --visible-height (from lib/keyboard.ts) shrinks it to what is visible. The tab bar hides itself with the keyboard (data-keyboard).
  • The phone root is w-full overflow-clip and its main is min-w-0: nothing inside can widen the document and scroll the whole screen sideways (clip, not hidden, so it is not a scroll container the browser moves when something takes focus).
  • The deck name in the header goes through useDeckName() (lib/use-deck-name.ts): the factory name "Untitled deck" is shown in the current language until the deck is renamed; if the field is not touched, what is saved does not change.
  • Toasts (sonner) are lifted above the tab bar on a phone (index.css), otherwise they would sit under it.
  • A game open on a phone hides the header and the tab bar (useTableFullscreen): the table takes the whole screen, and the table bar carries its own exit button that calls leaveTable().
  • Android's back: AppShell registers (touch only) a handler that, from Design, returns to Deck, and sets "Press again to leave" as the default, which saves the deck and the open card before app_exit. Open layers (dialogs, sheets, menus) are closed first by lib/back.ts; see Mobile.
  • On a phone, leaving Design with an unsaved card does not ask: the card is saved first and then the screen changes (the "Discard the changes?" prompt below is for desktop and tablet).
  • The deck-name field commits its text when the app goes to the background (a capture-phase visibilitychange listener), so the name typed is not lost before lib/lifecycle.ts saves the deck.
  • The help button of the header becomes "Tutorial of this screen" inside the "More" sheet on a phone.

Scroll per view (scroll-per-view.ts)

Switching tabs unmounts the previous view, so its scroll positions used to be lost. AppShell calls useScrollPerView(view, mainRef) with a ref to <main>:

  • Recording. One capture-phase scroll listener on <main> (scroll does not bubble) stores scrollTop of every ScrollArea viewport ([data-slot="scroll-area-viewport"]) in a Map<View, Map<index, top>> kept in a ref. The key of each scroll area is its order among the viewports inside <main>; dialogs are portalled outside <main>, so they never count.
  • Restoring. When a view becomes active, a requestAnimationFrame loop sets each saved scrollTop as soon as that viewport is tall enough (scrollHeight - clientHeight >= top), for up to 2 s (RESTORE_WINDOW_MS). Lists and the preview fill in after the first paint, so setting it once at mount would be clamped to 0. A wheel, pointerdown or keydown inside <main> stops the loop, so the restore never fights the user.
  • Why not keep the views mounted and hidden. display: none also resets the scroll, and the preview and the designer would keep working underneath (Live Preview, Designer UI).
  • Limits. In memory only (lost on closing the app). Because the key is the order, a scroll area that appears or disappears between visits (for example the Design form depending on whether a card is selected) can shift which one gets which position.

Leaving "Design" with an unsaved card

AppShell routes the tab switch through changeView(v). If the current view is design and useEditing.getState().pending is set (the card being designed has unsaved changes), the move is parked in leaveDesign and a second ConfirmDialog ("Discard the changes?" / "This card has unsaved changes.") asks with three outcomes: Cancel, Discard (destructive, runs the parked move) and Save and continue (saves through pending.save() and moves only if it returned true). Why it exists: DesignScreen unmounts when another view is shown, so before this guard the draft was dropped silently. Why the shell does not know how a card is saved: DesignScreen registers a save callback in useEditing while it has changes (State Stores, Designer UI), and the shell only calls it.

Full screen (F11) and window controls (lib/app-window.ts, window-controls.tsx)

F11 toggles full screen from any screen of the desktop app (Deck, Design, Library, Search, Play, with a dialog open or a field focused). It is not a table shortcut: initWindow() (called from main.tsx once app_platform says desktop; never on Android or iOS) hooks one keydown on window, in the capture phase and before anything mounts, so no dialog, field or table layer can swallow it. Bare F11 only (Ctrl, Alt, Meta or Shift make it something else), preventDefault() always, and a held key (e.repeat) does not repeat the toggle. The table bar's "Full screen (F11)" button and its menu entry call the same toggleFullscreen().

flowchart LR
    K["F11 / button"] --> Q["toggleFullscreen(): queued"]
    Q --> W["isFullscreen() then setFullscreen(!)"]
    W --> L["readStored(): isFullscreen() again"]
    R["window resize (rAF, once per frame)"] --> L
    L --> S["useAppWindow.complete"]
    S --> C["WindowControls shown or removed"]
Loading

Decisions and invariants:

  • The state is read, not assumed. The window can leave full screen without the app (a window-manager shortcut, a double click) and window-state restores it on start, so useAppWindow.complete is refreshed after each toggle and on every resize, at most once per frame. The controls therefore appear when the window is already the big one, never before, and nothing flickers on a window that is still small.
  • Toggles are queued. Two F11 presses in a row would both read "not full screen" and ask to enter twice; the second one starts from what the first left.
  • The controls only exist in full screen. The system hides its own buttons then, and with no close or minimize the mouse would be stuck. WindowControls renders nothing otherwise, so the bar loses no space the rest of the time, and it comes in with a short fade (animate-in, off with prefers-reduced-motion) so pressing F11 does not make the bar jump. Minimize uses minimize(); the middle button leaves full screen; Close uses close(), never destroy(), so ConfirmClose handles it exactly like the system X (save, ask if something would be lost).
  • Not on macOS (isMac()): its own full screen lowers the system buttons when the pointer reaches the edge.
  • Permissions. capabilities/default.json has core:window:allow-set-fullscreen, core:window:allow-minimize and core:window:allow-close; isFullscreen is in core:default. See Rust App Layer.

Closing the app (confirm-close.tsx)

ConfirmClose registers getCurrentWindow().onCloseRequested(...) once. Flow of one close request:

flowchart TD
    A["Close requested"] --> B{"Dialog already open?"}
    B -->|"yes"| C["preventDefault, nothing else"]
    B -->|"no"| D["saveNow(): flush the deck"]
    D --> E["pendingItems(unsavedDeck) in lib/close-guard.ts"]
    E --> F{"hasPendingWork?"}
    F -->|"no"| G["return without preventDefault: Tauri's wrapper calls destroy(), window closes"]
    F -->|"yes"| H["preventDefault + ConfirmDialog: Close Tapete?"]
    H --> I["Cancel: stay, ask again at the next attempt"]
    H --> J["Close anyway: cancelJob if a job runs, save deck, destroy()"]
    H --> K["Save and close (only with an unsaved card): useEditing.pending.save(), then close; if saving fails the dialog and the window stay"]
Loading

Decisions and invariants:

  • The deck is flushed first. Autosave waits 800 ms after the last change (State Stores), so a change made right before closing used to be lost. saveNow() runs on every close request; if it throws, "the deck could not be saved" becomes one more reason to ask (pendingItems(true)).
  • Reasons (src/lib/close-guard.ts, pendingItems() / hasPendingWork(); each is a field of PendingWork, and the dialog lists only those that apply): a long job (useJob.current, with its phase text: resolve, export, design language), an update downloading or installing (useUpdate.step is downloading or installing; an update that is merely available or ready does not count), an open dialog with a running process or unsaved typing (lib/open-dialogs.ts, below), the card being designed with unsaved changes (useEditing.pending), the deck failing to save, and a game open on the table (useTable.isActive, reason "There's a game on the table: it will be saved and you can resume it when you come back.").
  • The game is saved on every close request. Right after flushing the deck, the handler calls save() of src/features/table/connection.ts (table_save), and "Close anyway" calls it again before destroy(). An open game still counts as a reason so the user knows it will be waiting in "Play" (Game Table).
  • With no reason the dialog never appears. The handler returns without preventDefault() and the window closes as usual.
  • "Close anyway" is destructive: it cancels the running job through cancelJob() (export_cancel or job_cancel), tries to save the deck once more and calls destroy(). Exports write atomically, so closing in the middle of an export never leaves a half-written PDF under its final name. If destroy() fails, a toast says the window could not be closed.
  • A second close attempt while the dialog is open is ignored (isOpen ref): it is preventDefaulted and no second dialog stacks up.
  • Outside Tauri (the view opened in a plain browser during development) getCurrentWindow() throws and is caught: there is no window to guard.
  • 🛑 destroy() needs a permission. With a JavaScript onCloseRequested listener Tauri no longer closes the window by itself; the wrapper (or the handler) calls destroy(). That command is core:window:allow-destroy, which is not part of core:default / core:window:default, so src-tauri/capabilities/default.json lists it explicitly (see Rust App Layer). Without it the window could not be closed at all; the build validates the identifier.
  • The updater is not blocked by this guard. "Restart and update" saves the deck itself (saveNow()) and restarts from Rust (request_restart), which does not go through the window close request. Inferred: from Tauri's behaviour; not exercised end to end.
  • Not covered. Inferred: on macOS, Cmd+Q or "Quit" from the Dock may not emit a window close request, so the guard may not run there.

Dialogs that declare their state (src/lib/open-dialogs.ts)

Some dialogs own a long process or unsaved state of their own. They tell the close guard through useCloseGuardState({ inProgress, unsaved }), called with the same values the component already passes to DialogContent as busy / unsavedChanges. The hook keeps the latest values in a ref and registers a reader in a module-level Set (registerDialog, which returns the function that removes it); dialogsState() ORs all registered readers. Because the registering component is the dialog's Content, which only exists while the dialog is open, the registration lives exactly as long as the dialog is open.

Why a hook per dialog and not inside DialogContent: src/components/ui/ is read-only (inherited from the design system the app is based on), so dialog.tsx is not touched.

Dialog File inProgress unsaved
Design the deck src/features/design/batch-dialog.tsx running no
Export images src/features/design/png-dialog.tsx running no
Link in bulk src/features/variants/batch-link.tsx working reviewing rows (phase === "review" with rows)
Collections src/features/design/collections-dialog.tsx no changed

Dialogs without the hook are not asked. Inferred: they only get the typed-text rule of DialogContent for closing themselves, not for closing the app.

Tests: src/lib/__tests__/close-guard.test.ts (Testing and CI).

Boot (useInitialDeck, called from App)

  1. startAutosave() and startPlan() (see State Stores).
  2. A useDeck.subscribe that, whenever the open deck id changes, calls rebuildThumbnails() (src/features/design/renumber.ts) to re-render design thumbnails made stale by a changed collection, font or engine.
  3. openInitialDeck(t("Untitled deck")): reopen last_deck_id or create a new deck. The returned error (if any) is stored in the hook's state.
  4. Separately, a keydown listener for Ctrl/Cmd+Z (undo) and Shift variant (redo), disabled while typing in an input, textarea or contenteditable.

Window startup

Decision: the window is created hidden with a dark background colour and shown as soon as possible, to avoid a white flash.

  • tauri.conf.json: "visible": false, "backgroundColor": "#1d1b19".
  • src-tauri/src/lib.rs: the window-state plugin saves size/position/maximised state of all flags except VISIBLE (otherwise the saved state could show the window before it is painted). on_page_load shows the window on PageLoadEvent::Finished; a background thread shows it after 3 s if it is still hidden (page never loaded).
  • src/main.tsx also calls getCurrentWindow().show() right after render (it does not wait for a frame: WebKitGTK does not deliver requestAnimationFrame to hidden windows), and applyThemeBeforeMount() already set the right colours, so there is no light flash. See Frontend Architecture and Themes and Skins.

App icon in the theme colour (lib/live-icon.ts, src-tauri/src/app_icon.rs)

Desktop only. The taskbar icon follows the theme like the <Logo> of the top bar (which mixes the theme's primary into the felt).

  • Screen (startLiveIcon, started from main.tsx on desktop): a MutationObserver on <html> (class, data-theme, data-skin, style) and the system dark-mode query, debounced 250 ms, read the four colours of the logo (themeColors: color-mix(in oklab, var(--primary) 80 % / 55 % / 35 %, black) for the felt gradient and 8 % on white for the card), normalised to #rrggbb through a 1×1 canvas (whatever getComputedStyle returns; a colour the canvas cannot parse sends nothing rather than a black icon), and send them with app_icon only when they change.
  • Rust (app_icon::apply): proxy_core::icon::paint swaps those colours into icons/logo.svg (through placeholders, so a new colour equal to an old one is not swapped twice) and renders it with resvg; the 256 px result goes to every window (set_icon: the taskbar on Windows and on Linux desktops that use the window icon). The colours are stored in app_settings (app.icon; app.icono before migration 0014) and app_icon::apply_at_startup sets them in setup, before the hidden window is shown, so a restart opens with the right colour.
  • Linux, everywhere: it also writes proxy-builder.png (16 to 512 px) into the user's icon theme ($XDG_DATA_HOME/icons/hicolor/<n>x<n>/apps/), which wins over the package's icon of the same name (the Icon= of the .desktop, never renamed). That is what changes the menu, the desktop launcher and panels that take the .desktop icon instead of the window's (Cinnamon's). Files are rewritten only when their bytes change, and the theme folder's mtime is touched so GTK rereads it (an old icon-theme.cache stops counting). With the factory colours (the Nature theme) the files are deleted and the package icon comes back.
  • Linux, in real time (app_icon::launcher): panels such as Cinnamon's paint the .desktop icon and only re-check the icon theme when they repaint (on a focus change, at most every 5 s), so the theme files alone updated "sometimes". They do watch the launcher folders, so a copy of the system's Tapete.desktop (first match in XDG_DATA_DIRS) goes to $XDG_DATA_HOME/applications/ (which wins over it) with only Icon= changed to an absolute PNG whose name is the colours (<app_data_dir>/app-icon/<24 hex>.png: a new path the panel has not cached; the PNGs 4.1 left in icono/ stay, and shortcuts that point there are repointed), plus the marker line LAUNCHER_MARK and TryExec (the Exec program when the original has none, so the menu hides it if the app is uninstalled). Order matters for the taskbar: Cinnamon's grouped-window-list repaints the launcher icon on every window-icon change (notify::icon) but reloads the .desktop a moment after it changes, so apply writes the launcher, theme and shortcuts first, then sets the window icon, and notify_again sets it again at 2 s and 6 s (at 255/254 px, so it is a different icon and notifies; skipped if another colour arrived meanwhile, GENERATION), when the panel already has the new launcher. Old colour PNGs are kept (the newest 8, prune_old_pngs): deleting the one the panel was still painting left an empty slot. It is rebuilt from the system file at every start (apply_at_startup, in a thread) to pick up what an update changed; a copy without the marker (the user's own) is never touched (the marker 4.1 wrote, OLD_LAUNCHER_MARK, counts as ours too); with the factory colours ours is deleted and the PNGs cleaned. No system .desktop (AppImage, unpackaged runs): nothing. The Cinnamon menu takes the same launcher, so it changes at once too. Desktop shortcuts (copies of the .desktop in the desktop folder, desktop_dir) have the same lazy lookup in the file manager: update_desktop_shortcuts changes only the Icon= line of those that open this app (Exec=proxy-builder) and whose icon is the package's or one of ours, writing over the same file (it keeps the exec bit, the icon position and the trust); with the factory colours it goes back to Icon=proxy-builder. Symlinks are skipped. launcher_text and shortcut_with_icon are unit-tested.
  • Windows shortcuts and macOS's Dock keep the bundled icon (they come from the executable/bundle). Android: nothing.

Settings dialog (src/features/settings/settings-dialog.tsx)

Opened by the Settings button (AppShell keeps open in local state). DialogContent is sm:max-w-3xl with unsavedChanges={false} (nothing to lose when closing). The header shows the version read once with getVersion() from @tauri-apps/api/app ("Tapete v4.0.0") and, when an update is downloaded, the RestartToUpdate button. Its description lists what is inside: "Language, appearance, game table, updates and storage.".

Body, top to bottom:

Section Component Effect Persistence
Language LanguagePicker (src/components/language-picker.tsx): a Select with each language's flag and its own name, over the 15 languages of LANGUAGES (src/lib/languages.ts) Interface language, no reload. The new dictionary is loaded first and the switch happens when it arrives, so the screen never shows half-translated text. localStorage["proxybuilder.lang"]; see Internationalization.
Updates Updates (updates.tsx) Check now, download, restart; the auto-update switch. Switch: useUi().autoUpdate in proxybuilder.preferencias. State machine in memory.
Names in other languages LanguageNames (language-names.tsx) Optional download of the MTGJSON name index. On disk by Rust (see below).
Appearance Appearance (appearance.tsx) Mode, scale, smooth scroll, skin, filigree, background, material, effects, colour theme, "More themes...". localStorage keys listed in Themes and Skins.
Game table ("Game table", closed at first) TableSettings (table.tsx) Six groups, below. useUi().table in proxybuilder.preferencias, except the dice look (Rust) and the online identity (Rust); see Game Table.
Storage ("Storage") Storage (storage.tsx) Thumbnail cache size and "Clear thumbnail cache"; "Free up space" (opens FreeSpaceDialog: images no deck uses, and optimizing deck images). See below. Nothing (actions only).

On a phone the dialog is full screen (AdaptiveDialog) and the sections above are not stacked: SectionList shows one big row per section (Language, Updates, Names in other languages, Appearance, Game table, Storage) and tapping one enters it, with SectionBar to go back. Android's back inside a section returns to the list instead of closing the dialog (backOnEscape, Mobile). Inside a section, FieldSection takes fixed (always open, no fold button, since the section already has its own screen) and Row takes its help through WithHelp, so the explanation of a setting is reachable with a tap on touch.

Updates section (Updates)

  • Calls useUpdate.start() on mount. If supported === false it shows "Only in the installed app: this copy does not come from an installer (for example, in development)." and nothing else.
  • "Check now" (search) is disabled while busy; if a version is found and auto-update is on, it downloads straight away (like at startup).
  • When a version is available and auto is off: a "Download {version}" button. When downloaded (ready/installing): "Restart and update" button (dismisses the "update" toast, calls install(), and toasts the error if it fails).
  • A Progress bar appears while downloading; the last error is printed with message(error); the release notes (Markdown text, English) appear in a ScrollArea when present; "You have the latest version (vX)" when up to date.
  • The status line says that on .deb/.rpm installs the system will ask for the password on restart (UpdateInfo.needsPermission).

State machine details are in State Stores; the Rust updater, signature checks and release format are in Releases and Auto Updates. Installing is refused with Busy while a long job runs (the deck is saved first, the step goes back to ready). With a game open on the table the screen does not ask: the install is queued (onLeaveTable, toast "It will be installed when you leave the table.") and runs when the player leaves the table; Rust still refuses it with Busy reason: game_open as a safety net. Checking and downloading are not blocked.

On Android the updater works differently, with the same screen. The "Updates" section says "Android will ask you to confirm each installation"; the button reads "Install" instead of "Restart and update" (systemInstalls in the updater store, from the system_installs field of the Rust update info), because nothing restarts: the app downloads the APK, checks its signature again and hands it to the system installer, which asks for confirmation and relaunches the app itself. If the system does not yet allow this app to install packages, Rust opens that Android setting and answers Unsupported with reason: install_permission; the screen does not show that as an error and the user simply taps "Install" again afterwards. Any other failure offers "Download from GitHub" (update_open_release). See Releases and Auto Updates for the packaging and signature.

The same LanguagePicker picks the design language in the export panel and in the Design preview (src/features/export/export-panel.tsx, src/features/design/design-preview.tsx): interface, design and deck languages share the Scryfall codes of src/lib/languages.ts, so one component serves all three. The flags are Noto Color Emoji images (Flag in src/components/emoji.tsx), not the system emoji font, because Windows' Segoe UI Emoji has no flags; see Frontend Architecture.

Names in other languages (LanguageNames)

Optional download (about the size shown on the button, "Download (about N MB)") of the MTGJSON per-language name index, stored as SQLite by Rust, so cards typed by their Spanish (or other language) printed name that Scryfall lacks can be found locally, both in the list and when linking. Without it the app asks magicthegathering.io online, which is slower. Commands: names_index_info, names_index_download (progress event names://progress with phases; during the "reading" phase the bar is full and the text says "Preparing the index..."), names_index_remove (after a confirmation, "Remove the names in other languages?", since getting them back means downloading them again). Shows the count of downloaded names. See External Sources and Card Identification and OCR.

Appearance section

Documented control by control in Themes and Skins (mode, size 70 to 150 %, smooth scroll, Plano/Zeus/Hera, filigree, background, material, blur/grain/shadow, "Include the side panels", theme grid, "More themes...").

Smooth scroll (proxybuilder.smoothScroll, default on) mounts SmoothScroll (src/lib/SmoothScroll.ts) through SmoothScrollClient: the wheel animates the native scrollTop of the nearest scrollable ancestor. Turning it off destroys the instance.

Game table section (TableSettings)

Each control writes one field of useUi().table (TablePreferences in src/stores/ui-store.ts, factory values in DEFAULT_TABLE_PREFS) through setTableSettings, unless said otherwise. Stored preferences are merged over DEFAULT_TABLE_PREFS when read, so a field added later gets its factory value. Preferences saved by 4.1, with Spanish names and values, are read and rewritten in English (src/lib/stored-prefs.ts).

Group Controls (field)
"Play" Offer the aura and equipment bonus when attaching (offerBonus, on); see the phantom's life in solitaire (ghost, on); online, see how the others move and show them my cursor (liveMovement, on); wheel when drawing who goes first, only with several players (startingRoulette, on); follow the player whose turn it is, one setting per format: on the phone "Follow the active player" (followTurnLocal, on), elsewhere "Follow the player whose turn it is" (followTurnDesktop, off), and only the current format's row is shown; sparring intensity when starting solitaire (sparring, off; the entrance has the same picker); holding the button opens the card menu (holdToOpenMenu, off).
"Board" Size of the cards on the battlefield (cardSize, 25 to 200 %, 100); size of the large view (largeView, 200 to 500 px, 320); status panel next to the large view (statusPanel, on); "3D effect: dragged cards lift off and your hand has depth" (effect3d, off; screen only, see Game Table); with it on, "3D effect depth" (intensity3d: soft, medium, strong, extreme; medium).
"Dice and coins" (dice-look.tsx, DiceSettings) The look of your dice and coin, with a sample thrown by "Try it" exactly as on the table (LiveRoll: 3D with three.js, Rapier physics and shadows at the level chosen in Settings, falling back to CSS 3D or 2D; with sound): die colour ("Player's colour" = the app colour in solo and online games, the seat colour in a local game with several players; or your own), number colour, finish (smooth, pearl, marble, glitter, translucent), an own image on each face (replaces colour and finish) and the coin metal (gold, silver, copper). Not in useUi: useDiceAppearance (src/features/table/dice/appearance.ts) reads and writes it through table_dice_get, table_dice_set and table_dice_image; Rust keeps it in app_settings key table.dice and the image in the blob store (src-tauri/src/table/dice.rs). Changes are sent 250 ms after the last one.
"Sounds" One switch per group of sounds: dice and coins (diceSounds), cards: shuffle, draw, tap, play (cardSounds), passing the turn and your turn (turnSounds), chat messages and the sparring phantom (chatSounds), all on; one volume for all (volume, 0 to 100 %, 60).
"Online identity" (net-identity.tsx) Export the installation's online identity to a JSON file or import another one (asks first; the current one is kept as a copy in the app data folder). Done by Rust (net_identity_export, net_identity_import); importing is refused with Busy while a game or a room is open. Not a preference.
"Performance" Image quality on the battlefield (quality: 146, 244 or 488 px wide, 244); dice and coins (dice: auto, 3d with physics, css light 3D, 2d; auto); reduce animations (reduceMotion, off); shadows (shadows, on); frame counter (fps, off); "Performance mode (everything at minimum)" applies PERFORMANCE_MODE (src/features/table/fps.tsx: quality 146, no shadows, no 3D effect, reduced animations, no status panel).

TablePreferences also holds fields with no control here: sparringSeen (the sparring "how it works" card was shown), trackers (player counters shown next to the life), customCounters and favoriteCounters, barHidden and boardLayouts (board layout remembered per number of players), set from the table itself.

The same TableSettings section also opens during a game, from "Table settings" in the table bar (src/features/table/dialogs/settings.tsx), with inGame: the "Online identity" block is left out there because it cannot be changed with a game open (Rust would answer Busy), and a "Change playmat…" button is added for players (Game Table).

Update button, dot and toasts (auto-update.tsx)

Piece Behaviour
useAutoUpdate() Only when useUi().autoUpdate is true (default). After 8 s (FIRST_CHECK_MS) and then every 6 h (CHECK_EVERY_MS): start(); if unsupported stop; search(); if a version exists, download(). Network failures or no release are silent. Timers are cleared when the switch is turned off.
useUpdateNotices() One useUpdate.subscribe, mounted once in App: a loading toast "Downloading Tapete X..." with the percentage as description while downloading; a persistent success toast "Tapete X is ready" with a Restart action when download completes (once per version); an error toast "Couldn't download the update" with the mapped error if the download fails. All use toast id "update" so they replace each other.
UpdateButton Top-bar outline button "Update to X" visible only in ready/installing; spinner while installing; tooltip says whether the system will ask for a password.
UpdateDot Small dot on the Settings button: amber and pulsing while downloading; theme-primary when ready/installing.
useSettingsNotice() Tooltip/aria text for the Settings button while an update is in progress ("Downloading X..." / "X is ready: restart from Settings.").

The toast strings read the current language through a ref (texts.current = lang), so a language change mid-download is respected without resubscribing.

Where each preference lives (settings map)

Setting UI location Stored in
Interface language Settings localStorage proxybuilder.lang
Theme, mode, skin, background, material, blur, noise, shadow, scale, flags, smooth scroll Settings > Appearance localStorage proxybuilder.theme / .mode / .skin / .bg / .material / .blur / .noise / .shadow / .scale / .fxSidebar / .heraFiligree / .smoothScroll
Installed tweakcn themes Settings > More themes Rust files under the app data folder themes/, mirrored in proxybuilder.temasInstalados
Auto-update Settings > Updates useUi().autoUpdate (proxybuilder.preferencias)
Game table settings Settings > Mesa de juego useUi().table (proxybuilder.preferencias)
Dice and coin look Settings > Mesa de juego > "Dice and coins" Rust app_settings key table.dice (own image in the blob store)
Game table player name Play tab entrance localStorage proxybuilder.mesa.nombre
Game table mat (per deck and general) Play tab: "This deck's playmat…" and the table bar Rust app_settings keys table.playmat.<deck id>, table.playmat (blob protected in blob_refs)
Screens whose tutorial was already shown automatic (first visit) useUi().seenTutorials (proxybuilder.preferencias)
MTGJSON names index Settings Rust (downloaded file, SQLite index)
Card language, image policy, add tokens, preview quality, ask before replacing Decklist panel > Options useUi() (proxybuilder.preferencias)
Preview zoom, card info overlay Preview toolbar useUi() (proxybuilder.preferencias); "Show backs" is not persisted
Panel widths drag the handles localStorage proxybuilder.paneles, .panel-lista, .paneles.disenar
Section open/closed section headers localStorage proxybuilder.seccion.<id>
Library view, sort, grouping, size Library toolbar localStorage proxybuilder.biblioteca (filters not stored)
Last deck opened automatic Rust app_settings key last_deck_id
Last import folder / last export folder automatic Rust app_settings keys import_folder, export_folder
Window size, position, maximised automatic tauri-plugin-window-state (visibility excluded)
Print settings (page size, card size, margins, bleed, cut guides, etc.) and export presets Export panel Inside the deck (Deck.settings, saved with the deck); presets in Rust (preset_* commands). See Export.

Factory values worth knowing (they are product decisions, not accidents): interface language English; theme Nature (a green, like the logo) in dark mode with matte material; preview zoom 80 % (on a phone, the first time sheets appear the zoom fits the sheet to the screen width); preview quality 488 px (244 px with touch on a phone or tablet; a touch laptop counts as desktop and keeps 488); on a touch device the game table starts with shadows off and CSS 3D dice (defaultTablePrefs in ui-store.ts; whatever the person saved wins); "ask before replacing cards" on; auto-update on. Print defaults (2 mm gap, bleed 0, cut guides off, "Fill corners" off) live in the layout/export code, see Layout Engine.

Remembered folders (file dialogs)

All file dialogs go through src/lib/dialogs.ts; never call @tauri-apps/plugin-dialog directly.

Function Use
openForImport(options) Open dialog starting in the last import folder; returns the paths (array) or null; remembers the folder of the first path.
saveForExport(options, name) Save dialog starting in the last export folder with name as proposed file name.
chooseExportFolder() Directory picker (loose image export), also remembers the export folder.
remember(kind, path) Fire-and-forget remember; used when files are dragged onto the app.

Mechanics: folder_initial({ kind, name }) (Rust src-tauri/src/commands/folders.rs) returns the stored folder if it still exists (joined with name if given), otherwise name or null. folder_remember({ kind, path }) stores the directory of the path (the path itself if it is a directory, else its parent) under import_folder or export_folder in app_settings. FolderKind is "import" | "export" (generated type). Import and export folders are deliberately separate, so exporting a PDF to Desktop does not redirect the next image import. Failures of either command are swallowed (the dialog just opens at its default location). Used by features/decklist/actions.ts, features/export/actions.ts, features/export/export-menu.tsx, features/library/library-screen.tsx and the designer dialogs. Tests: src/lib/__tests__/dialogs.test.ts and commands/folders.rs unit test the_folder_of_a_path.

Cache and image-store maintenance

Two maintenance actions live where they are relevant and are also gathered in Settings > "Storage" (src/features/settings/storage.tsx), which is where people look for them; both places call the same commands:

  • Clear thumbnail cache: in the decklist panel (decklist-panel.tsx) and in Settings (which also shows the current size, "Thumbnail cache: {mb}"), a confirmation dialog shows size and file count from cache_stats and then cache_clear empties only the derived renders cache; deck images are never touched.
  • Free up space: the Library screen and Settings open the same dialog (features/library/free-space-dialog.tsx), which also optimizes deck images (Storage and Blobs); blob_gc removes blobs no deck references (the Rust side keeps recent ones for 24 h); the toast reports count and megabytes.

Rationale: deck images live in the blob store (they are data), the cache only holds derivatives and can always be deleted. See Storage and Blobs.

Failure modes

Situation Behaviour
localStorage blocked or corrupt Every read/write is in try/catch; defaults apply for the session.
getVersion() fails The version chip is simply not shown.
Update check fails (offline, no release, no package for this installer) Silent in the background; manual "Check now" shows the mapped error (Network, NotFound...).
Install fails (e.g. password prompt cancelled) State returns to ready, error toast; can retry without re-downloading.
Update while a PDF export runs or a game is open on the table update_install returns Busy (with a game, reason: game_open); the screen does not ask while the table is open: the install is queued and runs on leaving the table.
Closing the window with a job, a download, an unsaved card, a busy dialog, a failed deck save or a game open ConfirmClose asks; "Close anyway" cancels the job, saves the game and closes.
Closing the window with nothing pending The deck is flushed and the window closes without a dialog.
destroy() fails Toast "The window could not be closed."
Selected installed theme no longer exists SyncThemes resets to Nature.

Where to start when extending

  • New setting: if it affects the look, add to ThemeProvider-adjacent code only through new CSS/initial-theme.ts (the provider itself is read-only); if it is a list/preview preference, add it to useUi Preferences (State Stores); if the backend must know it across sessions, use app_setting_get/set or a dedicated command.
  • New Settings section: add a card component in src/features/settings/ and render it in SettingsDialog; text through t(); scrolling is already provided by DialogBody.

See also

Documentation · Documentación

Language: English · Español

Use and build · Uso y desarrollo

Architecture · Arquitectura

Data · Datos

Getting cards · Conseguir cartas

Layout, images, PDF · Maquetación, imagen y PDF

Card designer · Diseñador de cartas

Game table · Mesa de juego

Mobile · Móvil

Frontend · Frontend

Reference · Referencia

Clone this wiki locally