shell

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2026 License: MIT Imports: 46 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	HeaderH          float32 = 54
	HeaderActionsGap float32 = 4

	SBX       float32 = 10
	SBRowH    float32 = 32
	SBRowR    float32 = 9
	SBRowGap  float32 = 2
	SBIndent  float32 = 14
	SBRowIcon float32 = 18

	NoteStandardMaxW float32 = contracts.WidthStandard
	NoteWideMaxW     float32 = contracts.WidthWide

	HistoryDrawerW float32 = 320
	HistoryBannerH float32 = 40
)

Mote shell geometry constants (matching mote/src/app.rs & sidebar.rs).

View Source
const CommentsDrawerW float32 = 320

CommentsDrawerW matches Mote's 320pt right-side slide-over drawer width (same as HistoryDrawerW).

Variables

This section is empty.

Functions

func NoteColumnMaxWidth

func NoteColumnMaxWidth(pageWidth string) float32

NoteColumnMaxWidth returns the Mote reading column width in DIPs for pageWidth ("standard" -> 720, "wide" -> 960, "full" -> 0 meaning 100%).

Types

type App

type App struct {
	// contains filtered or unexported fields
}

App is Mote's 1:1 Mote pure-MyGo desktop application shell built strictly on internal/design, internal/theme, internal/assets, and internal/ui/*. It stores ZERO cross-frame ui.Element references.

func NewApp

func NewApp(st *state.AppState) *App

NewApp constructs a Mote desktop shell App bound to st.

func (*App) AcknowledgeSyncRecoveryKey

func (a *App) AcknowledgeSyncRecoveryKey() error

AcknowledgeSyncRecoveryKey clears the locally staged one-time recovery key after user confirmation.

func (*App) ActiveNoteComments

func (a *App) ActiveNoteComments() []model.CommentThread

ActiveNoteComments returns a copy of all active (open + resolved) comment threads for the loaded note.

func (*App) ActiveOrProposedDataDir

func (a *App) ActiveOrProposedDataDir() string

ActiveOrProposedDataDir returns the active local workspace DataDir if materialized, or the proposed local Data Folder path (~/.mote by default) when deferred.

func (*App) ApplyAvailableUpdate

func (a *App) ApplyAvailableUpdate()

ApplyAvailableUpdate downloads, SHA-256 verifies, and installs the discovered release.

func (*App) ChangeSyncPassphrase

func (a *App) ChangeSyncPassphrase(newPassphrase string, rotateRecovery bool) (string, error)

ChangeSyncPassphrase re-wraps the vault master key in manifest.json in O(1) without re-uploading data.

func (*App) CheckForUpdates

func (a *App) CheckForUpdates(manual bool)

CheckForUpdates queries GitHub Releases asynchronously and updates the Settings UI state. When manual is false (background startup check), network/offline errors stay calm.

func (*App) Close

func (a *App) Close()

Close flushes active work and releases timers and subscriptions.

func (*App) CloseCommentsDrawer

func (a *App) CloseCommentsDrawer()

CloseCommentsDrawer closes the right-side Comments Drawer.

func (*App) CloseSettings

func (a *App) CloseSettings()

CloseSettings leaves RouteSettings and returns to the active workspace route.

func (*App) CollapseAllFolders added in v0.0.8

func (a *App) CollapseAllFolders()

CollapseAllFolders collapses every expanded folder in the sidebar and persists the state.

func (*App) CommandSearchOpen

func (a *App) CommandSearchOpen() bool

CommandSearchOpen reports whether the Command & Search Palette is open.

func (*App) CommentsDrawerOpen

func (a *App) CommentsDrawerOpen() bool

CommentsDrawerOpen reports whether the right-side Comments Drawer is currently open.

func (*App) CommentsDrawerTab

func (a *App) CommentsDrawerTab() string

CommentsDrawerTab returns the active tab ("open" or "resolved") of the Comments Drawer.

func (*App) ConfigureSyncDir

func (a *App) ConfigureSyncDir(rawDir string) (string, *syncfolder.SyncReport, error)

ConfigureSyncDir connects or switches the encrypted Sync Folder using the cached local key or MOTE_SYNC_PASSPHRASE env fallback.

func (*App) ConfigureSyncDirWithCredential

func (a *App) ConfigureSyncDirWithCredential(rawDir, credential string) (string, string, *syncfolder.SyncReport, error)

ConfigureSyncDirWithCredential initializes a new encrypted Sync Folder or unlocks/connects an existing encrypted Sync Folder live without moving local SQLite (~/.mote). Returns (savedDir, oneTimeRecoveryKey, report, error).

func (*App) ConfigureUpdater

func (a *App) ConfigureUpdater(client *updater.Client, relaunchFn func(targetPath string, flavor updater.InstallFlavor))

ConfigureUpdater binds an updater.Client and optional relaunch handler to App.

func (*App) CopyNoteMarkdown

func (a *App) CopyNoteMarkdown(c *ui.Context, noteID string)

CopyNoteMarkdown copies noteID's Markdown representation to the system clipboard.

func (*App) CreateAndOpenNoteTemplate

func (a *App) CreateAndOpenNoteTemplate()

CreateAndOpenNoteTemplate creates a blank standalone Note Template and immediately opens it in the unified Side-Peek Template Editor.

func (*App) CreateFolder

func (a *App) CreateFolder(name string, parentID *string)

CreateFolder creates a new folder under parentID (nil for root).

func (*App) CreateNoteAndOpen

func (a *App) CreateNoteAndOpen(folderID *string)

CreateNoteAndOpen creates a blank note in folderID (nil for root) and opens it.

func (*App) CreateQuickDocAndOpen

func (a *App) CreateQuickDocAndOpen(folderID *string)

CreateQuickDocAndOpen creates a note or whiteboard according to UIPrefs.QuickCreateDefault / LastCreatedKind.

func (*App) CreateWhiteboardAndOpen

func (a *App) CreateWhiteboardAndOpen(folderID *string)

CreateWhiteboardAndOpen creates a blank standalone whiteboard in folderID and opens it.

func (*App) CurrentRoute

func (a *App) CurrentRoute() Route

CurrentRoute returns the active top-level Route.

func (*App) CurrentTarget

func (a *App) CurrentTarget() state.NavTarget

CurrentTarget returns the active workspace NavTarget.

func (*App) DeleteCollection

func (a *App) DeleteCollection(dbID string)

DeleteCollection soft-deletes a Collection by ID and navigates Home if currently viewing it.

func (*App) DeleteFolderToTrash

func (a *App) DeleteFolderToTrash(folderID string)

DeleteFolderToTrash soft-deletes folderID and offers a one-click Undo toast.

func (*App) DeleteNoteToTrash

func (a *App) DeleteNoteToTrash(noteID string)

DeleteNoteToTrash soft-deletes noteID and offers a one-click Undo toast.

func (*App) DeleteWhiteboardToTrash

func (a *App) DeleteWhiteboardToTrash(wbID string)

DeleteWhiteboardToTrash soft-deletes wbID and offers a one-click Undo toast.

func (*App) DisconnectSync

func (a *App) DisconnectSync() error

DisconnectSync disables Sync Folder synchronization and returns to local-only mode without deleting any data.

func (*App) DuplicateNote

func (a *App) DuplicateNote(noteID string)

DuplicateNote creates a "<title> (Copy)" copy of noteID in the same folder and opens it.

func (*App) DuplicateWhiteboard

func (a *App) DuplicateWhiteboard(wbID string)

DuplicateWhiteboard creates a "<title> (Copy)" copy of wbID in the same folder and opens it.

func (*App) EnsureWorkspaceActive

func (a *App) EnsureWorkspaceActive() error

EnsureWorkspaceActive materializes a deferred first-run workspace on demand (for example, when the user clicks "Save to Mote" in an External Markdown window before finishing Onboarding).

func (*App) ExportNoteMarkdown

func (a *App) ExportNoteMarkdown(noteID string)

ExportNoteMarkdown exports noteID as a .md file using the native save dialog.

func (*App) ExportWorkspaceZip

func (a *App) ExportWorkspaceZip()

ExportWorkspaceZip exports the entire workspace to a .zip backup archive.

func (*App) FlushAll

func (a *App) FlushAll()

FlushAll synchronously persists pending edits in the active note, pinned windows, and whiteboards.

func (*App) FlushBeforeWorkspaceSwitch

func (a *App) FlushBeforeWorkspaceSwitch()

FlushBeforeWorkspaceSwitch flushes all pending edits across the main editor, Side-Peek, template editor, standalone/modal whiteboards, and open Pinned Note sessions before tearing down the current workspace stack.

func (*App) FlushQuickNoteDraft

func (a *App) FlushQuickNoteDraft()

FlushQuickNoteDraft persists any unsaved Quick Note scratchpad draft to disk.

func (*App) FocusMode

func (a *App) FocusMode() bool

FocusMode reports whether distraction-free Focus Mode is active.

func (*App) FocusPinnedNoteInMain

func (a *App) FocusPinnedNoteInMain(noteID string)

FocusPinnedNoteInMain brings noteID to the foreground in the main Mote shell, exiting Settings/menus and reloading the latest persisted content if already open.

func (*App) HasAnyExpandedFolder added in v0.0.8

func (a *App) HasAnyExpandedFolder() bool

HasAnyExpandedFolder reports whether at least one sidebar folder is currently expanded.

func (*App) HasWorkspaceSwitcher

func (a *App) HasWorkspaceSwitcher() bool

HasWorkspaceSwitcher reports whether a live workspace switcher has been wired.

func (*App) HistoryOpen

func (a *App) HistoryOpen() bool

HistoryOpen reports whether the Version History slide-over drawer is currently open.

func (*App) HomeNoteID added in v0.0.8

func (a *App) HomeNoteID() string

HomeNoteID returns the currently pinned custom Home note ID, if any.

func (*App) ImportFiles

func (a *App) ImportFiles(files []ImportFile)

ImportFiles imports Markdown and Zip files asynchronously into noteops.

func (*App) InstantiateNoteTemplateAndOpen

func (a *App) InstantiateNoteTemplateAndOpen(tplID string, folderID *string)

func (*App) IsNotePinnedToDesktop

func (a *App) IsNotePinnedToDesktop(noteID string) bool

IsNotePinnedToDesktop reports whether noteID currently has an open floating desktop sticky window.

func (*App) IsWorkspaceDeferred

func (a *App) IsWorkspaceDeferred() bool

IsWorkspaceDeferred reports whether the app is currently running in clean first-run deferred mode (no SQLite store or Data Folder materialized on disk yet).

func (*App) LockSync

func (a *App) LockSync() error

LockSync removes the cached local VEK on this machine and pauses Sync Folder push/pull while keeping local SQLite editing and outbox queueing active.

func (*App) MainView

func (a *App) MainView(c *ui.Context)

MainView renders the complete 1:1 Mote two-pane pure-MyGo desktop shell.

func (*App) MigrateLocalStorageToDefault

func (a *App) MigrateLocalStorageToDefault() (string, error)

MigrateLocalStorageToDefault moves a legacy custom local SQLite directory back to ~/.mote (preserving the old folder untouched as backup) and clears bootstrap.json.

func (*App) MoveCollectionToFolder

func (a *App) MoveCollectionToFolder(dbID string, folderID *string)

MoveCollectionToFolder moves a Collection into folderID (nil moves to workspace root) with one-click Undo.

func (*App) MoveFolderToParent

func (a *App) MoveFolderToParent(folderID string, parentID *string)

MoveFolderToParent moves folderID under parentID (nil moves to root) with one-click Undo.

func (*App) MoveNoteToFolder

func (a *App) MoveNoteToFolder(noteID string, folderID *string)

MoveNoteToFolder moves noteID into folderID (nil moves to root) with one-click Undo.

func (*App) MoveWhiteboardToFolder

func (a *App) MoveWhiteboardToFolder(wbID string, folderID *string)

MoveWhiteboardToFolder moves wbID into folderID (nil moves to root) with one-click Undo.

func (*App) NavigateBack

func (a *App) NavigateBack() bool

NavigateBack flushes active work and steps backward in NavHistory.

func (*App) NavigateForward

func (a *App) NavigateForward() bool

NavigateForward flushes active work and steps forward in NavHistory.

func (*App) NavigateTo

func (a *App) NavigateTo(target state.NavTarget)

NavigateTo flushes active work and navigates to target.

func (*App) NewExternalMDSession

func (a *App) NewExternalMDSession(filePath string, hooks ExternalMDHooks) *ExternalMDSession

NewExternalMDSession creates an independent standalone document window session for filePath. It loads filePath directly from disk without touching Mote's SQLite workspace database.

func (*App) NewPinnedNoteSession

func (a *App) NewPinnedNoteSession(noteID string, hooks PinnedNoteHooks) *PinnedNoteSession

NewPinnedNoteSession creates an independent floating sticky note session for noteID. Each pinned note gets its own BlockEditor instance, autosave loop, and live event subscription.

func (*App) OnboardingStep

func (a *App) OnboardingStep() int

OnboardingStep returns the 1-based active onboarding step (1 or 2), or 0 when closed.

func (*App) OpenCollection

func (a *App) OpenCollection(dbID string)

OpenCollection navigates to a specific Collection (Database) view.

func (*App) OpenCommandSearch

func (a *App) OpenCommandSearch()

OpenCommandSearch opens the ⌘K / ⌘J Command & Search Palette.

func (*App) OpenCommentsDrawer

func (a *App) OpenCommentsDrawer()

OpenCommentsDrawer opens the 320pt right-side Comments Drawer for the active note.

func (*App) OpenConfirmDialog

func (a *App) OpenConfirmDialog(title, description, confirmLabel string, destructive bool, onConfirm func())

OpenConfirmDialog opens a Mote AlertDialog for destructive or guarded actions.

func (*App) OpenCreateCollectionDialog

func (a *App) OpenCreateCollectionDialog(folderID *string)

OpenCreateCollectionDialog immediately creates a blank Collection in folderID and opens it.

func (*App) OpenCreateFolderDialog

func (a *App) OpenCreateFolderDialog(parentID *string)

OpenCreateFolderDialog opens the Mote folder creation dialog.

func (*App) OpenDocInfo

func (a *App) OpenDocInfo(noteID string)

OpenDocInfo computes statistics for noteID and opens Mote's Document Info dialog.

func (*App) OpenFolder

func (a *App) OpenFolder(folderID string)

OpenFolder navigates to a folder view.

func (*App) OpenHistory

func (a *App) OpenHistory(noteID string)

OpenHistory opens the right-docked 320pt Version History slide-over drawer for noteID.

func (*App) OpenHome

func (a *App) OpenHome()

OpenHome navigates to the Home view.

func (*App) OpenHomeFavorites added in v0.0.8

func (a *App) OpenHomeFavorites()

OpenHomeFavorites navigates to Home and activates the Favorites tab.

func (*App) OpenMoveDialog

func (a *App) OpenMoveDialog(kind state.DocKind, docID string)

OpenMoveDialog opens the Mote folder picker dialog to move a note or whiteboard.

func (*App) OpenNote

func (a *App) OpenNote(noteID string)

OpenNote navigates to a note document view.

func (*App) OpenRenameDialog

func (a *App) OpenRenameDialog(kind string, id, currentName string)

OpenRenameDialog opens a clean Mote rename dialog for a folder, note, or whiteboard.

func (*App) OpenSettings

func (a *App) OpenSettings()

OpenSettings navigates to the full-page Settings view (RouteSettings).

func (*App) OpenSettingsSection

func (a *App) OpenSettingsSection(section string)

OpenSettingsSection navigates to Settings at the specified section key.

func (*App) OpenShortcuts

func (a *App) OpenShortcuts()

OpenShortcuts opens the keyboard shortcuts dialog.

func (*App) OpenTag

func (a *App) OpenTag(tag string)

OpenTag navigates to the workspace view filtered by a single global tag.

func (*App) OpenTags added in v0.0.8

func (a *App) OpenTags()

OpenTags navigates to the dedicated Tags index / cloud view in the main content area.

func (*App) OpenWhiteboard

func (a *App) OpenWhiteboard(wbID string)

OpenWhiteboard navigates to a standalone whiteboard document view.

func (*App) OpenWorkspaceRoot added in v0.0.11

func (a *App) OpenWorkspaceRoot()

OpenWorkspaceRoot navigates to the Workspace root gallery (All items, bypassing any pinned Home note).

func (*App) ParsedWhiteboardThumbSVG

func (a *App) ParsedWhiteboardThumbSVG(wbID, rawSVG string, dark bool) *ui.SVG

ParsedWhiteboardThumbSVG parses and caches a whiteboard thumbnail SVG (adapting strokes in dark mode). Exported for Wave 3B home_view.go document cards.

func (*App) ParsedWhiteboardThumbSVGVersioned added in v0.0.9

func (a *App) ParsedWhiteboardThumbSVGVersioned(
	wbID string,
	updatedAt int64,
	rawSVG string,
	dark bool,
	darkAdapt func(string) string,
) *ui.SVG

ParsedWhiteboardThumbSVGVersioned looks up a cached whiteboard SVG by (wbID, updatedAt, dark) in O(1) without hashing or running dark-mode string replacements on cache hits.

func (*App) PinNoteToDesktop

func (a *App) PinNoteToDesktop(noteID string)

PinNoteToDesktop flushes any pending edits for noteID in the main editor and opens (or focuses) noteID in an independent always-on-top desktop sticky window.

func (*App) PrepareQuickNoteForOpen

func (a *App) PrepareQuickNoteForOpen()

PrepareQuickNoteForOpen refreshes focus and clears transient menus whenever the floating Quick Note window is revealed via hotkey or menu bar.

func (*App) PurgeDatabase

func (a *App) PurgeDatabase(dbID string)

PurgeDatabase permanently deletes a soft-deleted Collection and its records.

func (*App) QuickNoteView

func (a *App) QuickNoteView(c *ui.Context)

QuickNoteView renders the redesigned frameless Apple Glass / Crafted Minimal floating Quick Note capture scratchpad with a borderless 22pt title, native rich BlockEditor body, destination picker (Home / Folder / Collection), inline tag chips, and frosted footer.

func (*App) RenameCollection

func (a *App) RenameCollection(dbID, newName string)

RenameCollection renames a Collection by ID.

func (*App) RenameFolder

func (a *App) RenameFolder(folderID, nextName string)

RenameFolder updates a folder's display name.

func (*App) RenameNote

func (a *App) RenameNote(noteID, nextTitle string)

RenameNote updates a note's title (keeping active editor state synchronized).

func (*App) ReplayOnboarding

func (a *App) ReplayOnboarding()

ReplayOnboarding opens the full-screen onboarding flow from step 1.

func (*App) ResetAfterWorkspaceSwitch

func (a *App) ResetAfterWorkspaceSwitch(keepOnboarding bool)

ResetAfterWorkspaceSwitch clears all transient per-workspace UI state after AppState has been rebound to a newly activated or switched workspace.

func (*App) RestartToApplyUpdate

func (a *App) RestartToApplyUpdate()

RestartToApplyUpdate flushes the active note and requests the desktop shell to relaunch the freshly installed Mote bundle/binary.

func (*App) RestoreDatabase

func (a *App) RestoreDatabase(dbID string)

RestoreDatabase restores a soft-deleted Collection from Trash.

func (*App) RestoreFolder

func (a *App) RestoreFolder(folderID string)

RestoreFolder restores a soft-deleted folder from Trash.

func (*App) RestoreNote

func (a *App) RestoreNote(noteID string)

RestoreNote restores a soft-deleted note from Trash.

func (*App) RestoreWhiteboard

func (a *App) RestoreWhiteboard(wbID string)

RestoreWhiteboard restores a soft-deleted whiteboard from Trash.

func (*App) SaveNoteAsTemplate

func (a *App) SaveNoteAsTemplate(noteID string)

func (*App) SaveRecordAsCollectionTemplate

func (a *App) SaveRecordAsCollectionTemplate(dbID, noteID string)

SaveRecordAsCollectionTemplate saves an existing Collection Record (its title, properties, tags, and body) as a reusable Collection template and opens it in the Template Editor.

func (*App) SetCommentsDrawerTab

func (a *App) SetCommentsDrawerTab(tab string)

SetCommentsDrawerTab switches the Comments Drawer tab ("open" or "resolved").

func (*App) SetHomeNote added in v0.0.8

func (a *App) SetHomeNote(noteID string)

SetHomeNote pins noteID as the user's custom Home starting page, or clears it when empty.

func (*App) SetLocalServerURL added in v0.0.8

func (a *App) SetLocalServerURL(rawURL string)

SetLocalServerURL stores the active local HTTP base URL (e.g. "http://127.0.0.1:5230") displayed in the read-only Settings -> CLI & MCP reference tab.

func (*App) SetLocalStorageMigrator

func (a *App) SetLocalStorageMigrator(fn func() (string, error))

SetLocalStorageMigrator registers the desktop session callback that safely migrates a legacy custom bootstrap.json SQLite directory back into default ~/.mote live.

func (*App) SetMainHTMLRenderer added in v0.0.6

func (a *App) SetMainHTMLRenderer(fn func(c *ui.Context, slotKey, rawHTML string, width float32, dark bool) bool)

SetMainHTMLRenderer binds the main desktop window's on-demand sandboxed HTML block renderer.

func (*App) SetOnPinNoteToDesktop

func (a *App) SetOnPinNoteToDesktop(fn func(noteID string))

SetOnPinNoteToDesktop registers a callback invoked when the user clicks "Pin to desktop" from Quick Note, Note Topbar, Document menu, Sidebar, or Home cards.

func (*App) SetOnRelaunchUpdate

func (a *App) SetOnRelaunchUpdate(fn func(targetPath string, flavor updater.InstallFlavor))

SetOnRelaunchUpdate registers the desktop shell callback invoked when the user clicks "Restart Mote" after an in-place update completes.

func (*App) SetOnboardingImportPicker

func (a *App) SetOnboardingImportPicker(fn func() (string, error))

SetOnboardingImportPicker overrides the native directory/file picker used by Step 2 "Import folder…" (primarily for deterministic headless tests).

func (*App) SetOnboardingSyncDirPicker

func (a *App) SetOnboardingSyncDirPicker(fn func() (string, error))

SetOnboardingSyncDirPicker overrides the native directory picker used by Step 1 "Choose…" / "Change…" (primarily for deterministic headless tests).

func (*App) SetOpenAttachmentFunc

func (a *App) SetOpenAttachmentFunc(fn func(sha256, filename, mimeType string, action editor.AttachmentAction) error)

SetOpenAttachmentFunc overrides the attachment open/reveal callback (primarily for tests).

func (*App) SetOpenImportFilesFunc

func (a *App) SetOpenImportFilesFunc(fn func() ([]ImportFile, error))

SetOpenImportFilesFunc overrides the native Open dialog handler (useful in tests).

func (*App) SetOpenImportFolderFunc

func (a *App) SetOpenImportFolderFunc(fn func() (string, error))

SetOpenImportFolderFunc overrides the native Open directory picker for folder imports (useful in tests).

func (*App) SetPageWidth

func (a *App) SetPageWidth(width string)

SetPageWidth sets the document column width ("standard" | "wide" | "full") and persists UIPrefs.

func (*App) SetPickImageFunc

func (a *App) SetPickImageFunc(fn func(onPicked func(uploaded *contracts.UploadedBlob, err error)))

SetPickImageFunc overrides the native image file picker callback (primarily for tests).

func (*App) SetProposedDataDir

func (a *App) SetProposedDataDir(dir string)

SetProposedDataDir sets the default proposed Data Folder path shown on Onboarding Step 1 while the workspace is deferred (before anything is materialized on disk).

func (*App) SetQuickNoteCloser

func (a *App) SetQuickNoteCloser(fn func())

SetQuickNoteCloser sets the callback invoked when QuickNoteView closes/hides.

func (*App) SetRecoveryFileSavePicker

func (a *App) SetRecoveryFileSavePicker(fn func(defaultPath string) (string, error))

SetRecoveryFileSavePicker overrides the native save dialog used by "Save file…" on the Recovery Key card (primarily for deterministic headless tests).

func (*App) SetSaveFileFunc

func (a *App) SetSaveFileFunc(fn func(defaultName string, data []byte, filterName string, exts []string) (string, error))

SetSaveFileFunc overrides the native Save dialog handler (useful in tests).

func (*App) SetSeedDemoOnFirstOnboarding

func (a *App) SetSeedDemoOnFirstOnboarding(enable bool)

SetSeedDemoOnFirstOnboarding enables the starter sample workspace toggle on Step 2 (default ON) so a brand-new desktop launch seeds the rich demo dataset upon finishing onboarding.

func (*App) SetSettingsSection

func (a *App) SetSettingsSection(section string)

SetSettingsSection selects a Settings section key.

func (*App) SetSettingsSyncDirPicker

func (a *App) SetSettingsSyncDirPicker(fn func() (string, error))

SetSettingsSyncDirPicker overrides the native directory picker used by Settings → Sync folder (primarily for deterministic headless testing).

func (*App) SetSurfaceMaterial

func (a *App) SetSurfaceMaterial(preset theme.SurfacePreset)

func (*App) SetSyncManager

func (a *App) SetSyncManager(mgr *syncfolder.Manager)

SetSyncManager binds the live Sync Folder manager to this desktop shell App.

func (*App) SetThemeMode

func (a *App) SetThemeMode(mode contracts.ThemeMode)

SetThemeMode updates and persists the theme appearance (system/light/dark).

func (*App) SetWorkspaceSwitcher

func (a *App) SetWorkspaceSwitcher(fn WorkspaceSwitcherFunc)

SetWorkspaceSwitcher registers the live workspace activation/hot-swap callback provided by the desktop session coordinator.

func (*App) SettingsOpen

func (a *App) SettingsOpen() bool

SettingsOpen reports whether RouteSettings is currently active.

func (*App) SettingsSection

func (a *App) SettingsSection() string

SettingsSection returns the active Settings section key.

func (*App) StartAutoUpdateCheck

func (a *App) StartAutoUpdateCheck()

StartAutoUpdateCheck schedules one calm, cooldown-throttled startup check when desktop settings allow automatic update checks.

func (*App) State

func (a *App) State() *state.AppState

State returns the underlying AppState.

func (*App) SyncInBackground added in v0.0.5

func (a *App) SyncInBackground()

SyncInBackground initiates a silent, non-blocking sync pass when an unlocked sync folder is active (e.g. when opening Settings). It refreshes the UI when remote changes arrive and surfaces conflict toasts, without showing noisy "Sync complete" toasts during normal automatic sync.

func (*App) SyncManager

func (a *App) SyncManager() *syncfolder.Manager

SyncManager returns the live Sync Folder manager bound to this App (may be nil in deferred/headless unit tests).

func (*App) SyncStatus

func (a *App) SyncStatus() syncfolder.SyncStatus

SyncStatus returns the current Sync Folder status snapshot. Caches SQLite/disk status probes per workspace snapshot version (with 1s TTL) so 120fps desktop render frames never stall on disk or SQLite I/O.

func (*App) ToastError

func (a *App) ToastError(title string, desc ...string)

ToastError pushes an error notification toast.

func (*App) ToastInfo

func (a *App) ToastInfo(title string, desc ...string)

ToastInfo pushes an informational notification toast.

func (*App) ToastSuccess

func (a *App) ToastSuccess(title string, desc ...string)

ToastSuccess pushes a success notification toast.

func (*App) ToastUndo

func (a *App) ToastUndo(title string, undoFn func())

ToastUndo pushes an actionable toast with a one-click "Undo" button.

func (*App) Toaster

func (a *App) Toaster() *design.Toaster

Toaster returns the global Mote Sonner-style Toaster mounted at the window root.

func (*App) ToggleCommentsDrawer

func (a *App) ToggleCommentsDrawer()

ToggleCommentsDrawer toggles the right-side Comments Drawer.

func (*App) ToggleDarkMode

func (a *App) ToggleDarkMode()

ToggleDarkMode flips light <-> dark mode and persists UIPrefs.

func (*App) ToggleFocusMode

func (a *App) ToggleFocusMode()

ToggleFocusMode toggles distraction-free Focus Mode.

func (*App) ToggleNotePin

func (a *App) ToggleNotePin(noteID string, currentlyPinned bool)

ToggleNotePin toggles the favorite/pinned flag on noteID.

func (*App) ToggleSidebar

func (a *App) ToggleSidebar()

ToggleSidebar collapses or expands the left sidebar and persists UIPrefs.

func (*App) ToggleWhiteboardPin

func (a *App) ToggleWhiteboardPin(wbID string, currentlyPinned bool)

ToggleWhiteboardPin toggles the favorite/pinned flag on wbID.

func (*App) TriggerImport

func (a *App) TriggerImport()

TriggerImport opens a native file picker for .md/.markdown/.zip files and imports them.

func (*App) TriggerImportFolder

func (a *App) TriggerImportFolder()

TriggerImportFolder opens a native folder picker, packs all Markdown files and local relative image assets into an archive copy, and imports them into the workspace.

func (*App) TriggerSyncNow

func (a *App) TriggerSyncNow()

TriggerSyncNow initiates an immediate synchronization pass in the background and surfaces honest status/toasts.

func (*App) UnlockSync

func (a *App) UnlockSync(credential string) (*syncfolder.SyncReport, error)

UnlockSync unlocks the currently configured encrypted Sync Folder using a passphrase or recovery key.

func (*App) UnpinNoteFromDesktop

func (a *App) UnpinNoteFromDesktop(noteID string)

UnpinNoteFromDesktop flushes and closes the floating desktop sticky window for noteID, if open.

func (*App) UpdateDesktopSettings

func (a *App) UpdateDesktopSettings(patch config.DesktopSettingsPatch) error

UpdateDesktopSettings persists a patch to DesktopSettingsStore and refreshes state.

type ExternalMDHooks

type ExternalMDHooks struct {
	SetWindowTitle       func(title string)
	SetDocumentEdited    func(edited bool)
	OpenNoteInMainWindow func(noteID string)
	CloseWindow          func()
	ForceCloseWindow     func()
	Invalidate           func()
	RenderHTMLBlock      func(c *ui.Context, slotKey, rawHTML string, width float32, dark bool) bool
}

ExternalMDHooks links an independent ExternalMDSession to its hosting standalone OS window and the main Mote desktop shell.

type ExternalMDSession

type ExternalMDSession struct {
	// contains filtered or unexported fields
}

ExternalMDSession owns the standalone block editor, disk round-trip persistence, in-memory local relative image preview cache, and explicit "Save to Mote" import flow for a single external local Markdown file. Merely opening, viewing, or editing an external file NEVER writes to Mote's SQLite workspace database or CAS blob storage.

func (*ExternalMDSession) Close

func (s *ExternalMDSession) Close()

Close releases in-memory caches and unregisters this session from shell.App. Unlike PinnedNoteSession, Close does NOT silently overwrite the user's disk file.

func (*ExternalMDSession) DisplayTitle

func (s *ExternalMDSession) DisplayTitle() string

DisplayTitle resolves the human-readable title for this document: YAML frontmatter title -> leading H1 heading in editor -> filename stem without Markdown extension.

func (*ExternalMDSession) Editor

Editor returns the independent BlockEditorHandle owned by this session.

func (*ExternalMDSession) FileName

func (s *ExternalMDSession) FileName() string

FileName returns the base filename (e.g. "readme.md").

func (*ExternalMDSession) FilePath

func (s *ExternalMDSession) FilePath() string

FilePath returns the absolute disk path bound to this standalone session.

func (*ExternalMDSession) ImportedNoteID

func (s *ExternalMDSession) ImportedNoteID() string

ImportedNoteID returns the Mote note ID once this file has been saved into Mote (empty beforehand).

func (*ExternalMDSession) IsClosePromptOpen

func (s *ExternalMDSession) IsClosePromptOpen() bool

IsClosePromptOpen reports whether the unsaved-changes close confirmation dialog is open.

func (*ExternalMDSession) IsDirty

func (s *ExternalMDSession) IsDirty() bool

IsDirty reports whether unsaved edits exist relative to the file on disk.

func (*ExternalMDSession) IsImportedOutOfSync

func (s *ExternalMDSession) IsImportedOutOfSync() bool

IsImportedOutOfSync reports whether this document has diverged from the last copy synced to Mote.

func (*ExternalMDSession) IsPathPopoverOpen

func (s *ExternalMDSession) IsPathPopoverOpen() bool

IsPathPopoverOpen reports whether the compact parent folder path info popover is open.

func (*ExternalMDSession) LoadError

func (s *ExternalMDSession) LoadError() string

LoadError returns any error encountered while reading the file from disk.

func (*ExternalMDSession) OpenImportedInMain

func (s *ExternalMDSession) OpenImportedInMain()

OpenImportedInMain focuses the main Mote window directly on the note created by SaveToMote.

func (*ExternalMDSession) ParentDirName

func (s *ExternalMDSession) ParentDirName() string

ParentDirName returns the compact parent directory name displayed in the topbar badge.

func (*ExternalMDSession) ReloadFromDisk

func (s *ExternalMDSession) ReloadFromDisk()

ReloadFromDisk reloads the external Markdown file from disk, discarding unsaved in-memory edits.

func (*ExternalMDSession) RequestClose

func (s *ExternalMDSession) RequestClose() bool

RequestClose is the OnClose guard for the standalone OS window hosting this session. It returns true when the window may close immediately (no unsaved disk edits, closed, or load error). When unsaved edits exist, it opens the in-window Save / Discard / Cancel prompt and returns false so the host window prevents immediate destruction.

func (*ExternalMDSession) RevealInFinder

func (s *ExternalMDSession) RevealInFinder() error

RevealInFinder reveals the bound external Markdown file in macOS Finder (or the platform file manager).

func (*ExternalMDSession) SaveToDisk

func (s *ExternalMDSession) SaveToDisk() error

SaveToDisk flushes the block editor AST, serializes back to lossless Markdown, writes atomically to the exact original filePath on disk, clears dirty state, and displays a calm "Saved to disk" pill toast. Never modifies Mote's SQLite database.

func (*ExternalMDSession) SaveToMote

func (s *ExternalMDSession) SaveToMote(folderID *string) (string, error)

SaveToMote imports the external Markdown document (including any current in-memory edits and all referenced local relative images uploaded into blob.Service) into Mote's SQLite workspace library, optionally into folderID (nil = Home/root). Refreshes AppState so the main Mote window reflects the newly archived note immediately.

func (*ExternalMDSession) SerializeMarkdown

func (s *ExternalMDSession) SerializeMarkdown() string

SerializeMarkdown renders the current editor document back to lossless Markdown, preserving any original YAML frontmatter and local relative image paths verbatim.

func (*ExternalMDSession) SetRevealPathFunc

func (s *ExternalMDSession) SetRevealPathFunc(fn func(path string) error)

SetRevealPathFunc overrides the OS reveal handler (used by tests to avoid opening Finder).

func (*ExternalMDSession) UpdateInMote

func (s *ExternalMDSession) UpdateInMote() (string, error)

UpdateInMote re-syncs subsequent edits (and any newly referenced local images) into the previously imported Mote note. If the imported note was deleted or trashed in Mote, UpdateInMote gracefully creates a fresh archived copy and links the session to it.

func (*ExternalMDSession) View

func (s *ExternalMDSession) View(c *ui.Context)

View renders the complete standalone external Markdown document window with calm 48pt topbar, "Save to Mote" split import control, full BlockEditor canvas, and status pills.

type ImportFile

type ImportFile struct {
	Name string
	Path string
	Data []byte
}

ImportFile represents a local Markdown or Zip file loaded for import without external UI library types.

func (ImportFile) ReadAll

func (f ImportFile) ReadAll() ([]byte, error)

ReadAll returns the in-memory bytes or reads from Path if Data is empty.

type PinnedNoteHooks

type PinnedNoteHooks struct {
	IsAlwaysOnTop     func() bool
	ToggleAlwaysOnTop func() bool
	SetWindowTitle    func(title string)
	OpenInMainWindow  func()
	CloseWindow       func()
	Invalidate        func()
	RenderHTMLBlock   func(c *ui.Context, slotKey, rawHTML string, width float32, dark bool) bool
}

PinnedNoteHooks links an independent PinnedNoteSession to its hosting floating OS window and the main Mote desktop shell.

type PinnedNoteSession

type PinnedNoteSession struct {
	// contains filtered or unexported fields
}

PinnedNoteSession owns the independent editor, title buffer, autosave timer, toaster, and real-time bidirectional workspace sync for a single floating desktop sticky note window.

func (*PinnedNoteSession) Close

func (s *PinnedNoteSession) Close()

Close flushes pending edits, stops timers, and unsubscribes from workspace events. Safe to call multiple times.

func (*PinnedNoteSession) Editor

Editor returns the independent BlockEditorHandle owned by this pinned session.

func (*PinnedNoteSession) Flush

func (s *PinnedNoteSession) Flush()

Flush synchronously flushes the block editor buffer and persists any pending changes to SQLite. Idempotent and safe to call on ⌘S, Open-in-Main, window close, and application shutdown.

func (*PinnedNoteSession) IsAlwaysOnTop

func (s *PinnedNoteSession) IsAlwaysOnTop() bool

IsAlwaysOnTop reports whether this pinned sticky window is currently floating above other windows.

func (*PinnedNoteSession) IsDirty

func (s *PinnedNoteSession) IsDirty() bool

IsDirty reports whether unsaved local edits are pending persistence.

func (*PinnedNoteSession) IsMissing

func (s *PinnedNoteSession) IsMissing() bool

IsMissing reports whether the pinned note was permanently deleted or cannot be found.

func (*PinnedNoteSession) IsTrashed

func (s *PinnedNoteSession) IsTrashed() bool

IsTrashed reports whether the pinned note is currently in Trash.

func (*PinnedNoteSession) NoteID

func (s *PinnedNoteSession) NoteID() string

NoteID returns the note ID bound to this pinned session.

func (*PinnedNoteSession) OpenInMainWindow

func (s *PinnedNoteSession) OpenInMainWindow()

OpenInMainWindow flushes pending edits synchronously, brings the main Mote window to the front, and navigates it to this note.

func (*PinnedNoteSession) RequestClose

func (s *PinnedNoteSession) RequestClose()

RequestClose flushes pending edits synchronously and requests that the hosting window close.

func (*PinnedNoteSession) RestoreNote

func (s *PinnedNoteSession) RestoreNote()

RestoreNote restores a soft-deleted pinned note from Trash and resumes live editing.

func (*PinnedNoteSession) SaveNow

func (s *PinnedNoteSession) SaveNow()

SaveNow flushes edits synchronously and shows a single calm "Saved" confirmation in the topbar status.

func (*PinnedNoteSession) Title

func (s *PinnedNoteSession) Title() string

Title returns the current title buffer of this pinned note.

func (*PinnedNoteSession) ToggleAlwaysOnTop

func (s *PinnedNoteSession) ToggleAlwaysOnTop() bool

ToggleAlwaysOnTop toggles AlwaysOnTop on/off and returns the new state.

func (*PinnedNoteSession) View

func (s *PinnedNoteSession) View(c *ui.Context)

View renders this pinned sticky note window's complete UI frame.

type Route

type Route uint8

Route represents the top-level shell route rendered by App.MainView.

const (
	RouteHome Route = iota
	RouteFolder
	RouteNote
	RouteWhiteboard
	RouteCollection
	RouteSettings
)

type WorkspaceSwitchOptions

type WorkspaceSwitchOptions struct {
	// MarkOnboardingCompleted persists OnboardingCompleted=true in the target folder's
	// ui_prefs.json after opening (used when switching from Settings or skipping Onboarding).
	MarkOnboardingCompleted bool
	// KeepOnboardingOpen preserves the active Onboarding flow after switching (used when
	// advancing from Onboarding Step 1 to Step 2 or switching folders during Onboarding).
	KeepOnboardingOpen bool
	// OverrideQuickNoteHotkey, when non-nil, overrides the target workspace's QuickNoteHotkey
	// and persists it into <target>/desktop.json (used for hotkeys recorded on Step 1 before
	// workspace materialization).
	OverrideQuickNoteHotkey *string
	// SyncDirSet, when true, configures (non-empty SyncDir) or disconnects (empty SyncDir)
	// the encrypted OpLog Sync Folder immediately after opening the local SQLite database.
	SyncDirSet     bool
	SyncDir        string
	SyncPassphrase string
}

WorkspaceSwitchOptions controls how the host desktop session activates a deferred workspace or live hot-swaps the active workspace to a different Data Folder.

type WorkspaceSwitcherFunc

type WorkspaceSwitcherFunc func(targetDir string, opts WorkspaceSwitchOptions) (string, error)

WorkspaceSwitcherFunc activates a deferred workspace or hot-swaps the running workspace to targetDir without restarting the desktop process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL