feat: auto-build, GitHub Release, and in-app updater (#14)
* ci: auto-release workflow on merge to main
Rewrite .github/workflows/release.yml to trigger on every push to main
instead of manual tag pushes. The workflow now:
- Computes version as 0.YYYYMMDD.GITHUB_RUN_NUMBER
- Builds aarch64-apple-darwin and x86_64-apple-darwin in parallel
- Merges them into a universal binary using lipo
- Creates a universal .dmg and signed updater tarball
- Generates latest.json with per-arch and universal platform entries
- Publishes a GitHub Release with auto-generated release notes
- Updates a GitHub Pages release history site (gh-pages branch)
Product decisions:
- Universal binary approach: copy arm64 .app as base, lipo the main
executable, keep everything else from arm64 (shared frameworks are
architecture-independent). This is the standard Tauri pattern.
- Per-arch updater tarballs are also uploaded so the Tauri updater can
download the correct arch-specific build (smaller download).
- Release notes are auto-generated from git log since last tag.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: github pages with release history
Use peaceiris/actions-gh-pages@v4 to deploy a release history site.
The page fetches releases.json (also deployed) and renders each release
with date, notes, and download links for .dmg files.
This handles the gh-pages branch creation automatically on first run.
The page is available at https://refactoringhq.github.io/laputa-app/
Product decision: used fetch() to load releases.json at runtime instead
of inlining it, which is cleaner and avoids shell escaping issues with
release note content. The releases.json is deployed alongside index.html.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: in-app update notification UI
Replace the old window.confirm updater with a proper React-based
update notification system:
- useUpdater hook now exposes state machine (idle → available →
downloading → ready) and actions (startDownload, openReleaseNotes,
dismiss)
- UpdateBanner component renders at the top of the app shell:
- "Available" state: shows version, Release Notes link, Update Now
button, dismiss X
- "Downloading" state: animated spinner, progress bar with percentage
- "Ready" state: Restart Now button to apply the update
- Silently checks on startup after 3s delay; fails silently on
network errors or 404
- Release Notes link opens the GitHub Pages release history site
Product decisions:
- Banner at top of app (not a modal) — non-intrusive, visible but
not blocking. User can dismiss and continue working.
- Progress bar shows during download so user knows it's working.
- Separate "Restart Now" state after download so user controls when
the app restarts (they may have unsaved work).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: updater component tests
Rewrite useUpdater hook tests and add UpdateBanner component tests:
Hook tests (10 cases):
- Starts in idle state
- Does nothing when not in Tauri
- Checks for updates after 3s delay
- Stays idle when no update available
- Transitions to available when update found
- Handles missing release body gracefully
- Stays idle on network error (fails silently)
- Dismiss returns to idle
- openReleaseNotes opens correct URL
- startDownload transitions through downloading to ready
Component tests (10 cases):
- Renders nothing when idle
- Renders nothing on error
- Shows version and buttons when available
- Update Now calls startDownload
- Release Notes calls openReleaseNotes
- Dismiss button works
- Shows progress bar during download
- Shows 0% at start of download
- Shows restart button when ready
- Restart button calls restartApp
All 457 tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: auto-build-release wireframes
Copy ui-design.pen as base. Frames to be added for:
1. Update notification banner (visible state) — horizontal bar at
top of app shell with version text, Release Notes link, Update
Now button, and dismiss X
2. Update download progress state — spinner icon, progress bar with
percentage, downloading text
3. "Restart to apply" state — green accent, version text, Restart
Now button
Note: Pencil editor was not available during this session. The base
design file is committed; frames will be added when the editor is
accessible. The implemented component (UpdateBanner.tsx) serves as
the source of truth for the design.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update ARCHITECTURE.md with release/update system
Add comprehensive documentation for:
- Release pipeline (4-phase workflow: version → build → release → pages)
- Versioning scheme (0.YYYYMMDD.RUN_NUMBER)
- Universal binary strategy (lipo merge)
- Updater endpoint and latest.json manifest
- In-app update UI state machine
- GitHub Pages release history site
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: rustfmt formatting
* fix: rustfmt build.rs
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:50:36 +01:00
|
|
|
use tauri::{
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
menu::{MenuBuilder, MenuItemBuilder, MenuItemKind, Submenu, SubmenuBuilder},
|
|
|
|
|
App, AppHandle, Emitter,
|
feat: auto-build, GitHub Release, and in-app updater (#14)
* ci: auto-release workflow on merge to main
Rewrite .github/workflows/release.yml to trigger on every push to main
instead of manual tag pushes. The workflow now:
- Computes version as 0.YYYYMMDD.GITHUB_RUN_NUMBER
- Builds aarch64-apple-darwin and x86_64-apple-darwin in parallel
- Merges them into a universal binary using lipo
- Creates a universal .dmg and signed updater tarball
- Generates latest.json with per-arch and universal platform entries
- Publishes a GitHub Release with auto-generated release notes
- Updates a GitHub Pages release history site (gh-pages branch)
Product decisions:
- Universal binary approach: copy arm64 .app as base, lipo the main
executable, keep everything else from arm64 (shared frameworks are
architecture-independent). This is the standard Tauri pattern.
- Per-arch updater tarballs are also uploaded so the Tauri updater can
download the correct arch-specific build (smaller download).
- Release notes are auto-generated from git log since last tag.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* ci: github pages with release history
Use peaceiris/actions-gh-pages@v4 to deploy a release history site.
The page fetches releases.json (also deployed) and renders each release
with date, notes, and download links for .dmg files.
This handles the gh-pages branch creation automatically on first run.
The page is available at https://refactoringhq.github.io/laputa-app/
Product decision: used fetch() to load releases.json at runtime instead
of inlining it, which is cleaner and avoids shell escaping issues with
release note content. The releases.json is deployed alongside index.html.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: in-app update notification UI
Replace the old window.confirm updater with a proper React-based
update notification system:
- useUpdater hook now exposes state machine (idle → available →
downloading → ready) and actions (startDownload, openReleaseNotes,
dismiss)
- UpdateBanner component renders at the top of the app shell:
- "Available" state: shows version, Release Notes link, Update Now
button, dismiss X
- "Downloading" state: animated spinner, progress bar with percentage
- "Ready" state: Restart Now button to apply the update
- Silently checks on startup after 3s delay; fails silently on
network errors or 404
- Release Notes link opens the GitHub Pages release history site
Product decisions:
- Banner at top of app (not a modal) — non-intrusive, visible but
not blocking. User can dismiss and continue working.
- Progress bar shows during download so user knows it's working.
- Separate "Restart Now" state after download so user controls when
the app restarts (they may have unsaved work).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* test: updater component tests
Rewrite useUpdater hook tests and add UpdateBanner component tests:
Hook tests (10 cases):
- Starts in idle state
- Does nothing when not in Tauri
- Checks for updates after 3s delay
- Stays idle when no update available
- Transitions to available when update found
- Handles missing release body gracefully
- Stays idle on network error (fails silently)
- Dismiss returns to idle
- openReleaseNotes opens correct URL
- startDownload transitions through downloading to ready
Component tests (10 cases):
- Renders nothing when idle
- Renders nothing on error
- Shows version and buttons when available
- Update Now calls startDownload
- Release Notes calls openReleaseNotes
- Dismiss button works
- Shows progress bar during download
- Shows 0% at start of download
- Shows restart button when ready
- Restart button calls restartApp
All 457 tests pass.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* design: auto-build-release wireframes
Copy ui-design.pen as base. Frames to be added for:
1. Update notification banner (visible state) — horizontal bar at
top of app shell with version text, Release Notes link, Update
Now button, and dismiss X
2. Update download progress state — spinner icon, progress bar with
percentage, downloading text
3. "Restart to apply" state — green accent, version text, Restart
Now button
Note: Pencil editor was not available during this session. The base
design file is committed; frames will be added when the editor is
accessible. The implemented component (UpdateBanner.tsx) serves as
the source of truth for the design.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update ARCHITECTURE.md with release/update system
Add comprehensive documentation for:
- Release pipeline (4-phase workflow: version → build → release → pages)
- Versioning scheme (0.YYYYMMDD.RUN_NUMBER)
- Universal binary strategy (lipo merge)
- Updater endpoint and latest.json manifest
- In-app update UI state machine
- GitHub Pages release history site
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: rustfmt formatting
* fix: rustfmt build.rs
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 11:50:36 +01:00
|
|
|
};
|
2026-02-22 18:44:54 +01:00
|
|
|
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
// Custom menu item IDs that emit events to the frontend.
|
|
|
|
|
const APP_SETTINGS: &str = "app-settings";
|
|
|
|
|
const FILE_NEW_NOTE: &str = "file-new-note";
|
|
|
|
|
const FILE_QUICK_OPEN: &str = "file-quick-open";
|
|
|
|
|
const FILE_SAVE: &str = "file-save";
|
|
|
|
|
const FILE_CLOSE_TAB: &str = "file-close-tab";
|
|
|
|
|
const VIEW_EDITOR_ONLY: &str = "view-editor-only";
|
|
|
|
|
const VIEW_EDITOR_LIST: &str = "view-editor-list";
|
|
|
|
|
const VIEW_ALL: &str = "view-all";
|
|
|
|
|
const VIEW_TOGGLE_INSPECTOR: &str = "view-toggle-inspector";
|
|
|
|
|
const VIEW_COMMAND_PALETTE: &str = "view-command-palette";
|
|
|
|
|
|
|
|
|
|
const CUSTOM_IDS: &[&str] = &[
|
|
|
|
|
APP_SETTINGS,
|
|
|
|
|
FILE_NEW_NOTE,
|
|
|
|
|
FILE_QUICK_OPEN,
|
|
|
|
|
FILE_SAVE,
|
|
|
|
|
FILE_CLOSE_TAB,
|
|
|
|
|
VIEW_EDITOR_ONLY,
|
|
|
|
|
VIEW_EDITOR_LIST,
|
|
|
|
|
VIEW_ALL,
|
|
|
|
|
VIEW_TOGGLE_INSPECTOR,
|
|
|
|
|
VIEW_COMMAND_PALETTE,
|
2026-02-22 18:44:54 +01:00
|
|
|
];
|
|
|
|
|
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
/// IDs of menu items that should be disabled when no note tab is active.
|
|
|
|
|
const NOTE_DEPENDENT_IDS: &[&str] = &[FILE_SAVE, FILE_CLOSE_TAB];
|
2026-02-25 18:30:20 +01:00
|
|
|
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
type MenuResult = Result<Submenu<tauri::Wry>, Box<dyn std::error::Error>>;
|
|
|
|
|
|
|
|
|
|
fn build_app_menu(app: &App) -> MenuResult {
|
|
|
|
|
let settings_item = MenuItemBuilder::new("Settings...")
|
|
|
|
|
.id(APP_SETTINGS)
|
|
|
|
|
.accelerator("CmdOrCtrl+,")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
|
|
|
|
|
Ok(SubmenuBuilder::new(app, "Laputa")
|
|
|
|
|
.about(None)
|
|
|
|
|
.separator()
|
|
|
|
|
.item(&settings_item)
|
|
|
|
|
.separator()
|
|
|
|
|
.services()
|
|
|
|
|
.separator()
|
|
|
|
|
.hide()
|
|
|
|
|
.hide_others()
|
|
|
|
|
.show_all()
|
|
|
|
|
.separator()
|
|
|
|
|
.quit()
|
|
|
|
|
.build()?)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn build_file_menu(app: &App) -> MenuResult {
|
|
|
|
|
let new_note = MenuItemBuilder::new("New Note")
|
|
|
|
|
.id(FILE_NEW_NOTE)
|
|
|
|
|
.accelerator("CmdOrCtrl+N")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let quick_open = MenuItemBuilder::new("Quick Open")
|
|
|
|
|
.id(FILE_QUICK_OPEN)
|
|
|
|
|
.accelerator("CmdOrCtrl+P")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let save = MenuItemBuilder::new("Save")
|
|
|
|
|
.id(FILE_SAVE)
|
|
|
|
|
.accelerator("CmdOrCtrl+S")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let close_tab = MenuItemBuilder::new("Close Tab")
|
|
|
|
|
.id(FILE_CLOSE_TAB)
|
|
|
|
|
.accelerator("CmdOrCtrl+W")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
|
|
|
|
|
Ok(SubmenuBuilder::new(app, "File")
|
|
|
|
|
.item(&new_note)
|
|
|
|
|
.item(&quick_open)
|
|
|
|
|
.separator()
|
|
|
|
|
.item(&save)
|
|
|
|
|
.separator()
|
|
|
|
|
.item(&close_tab)
|
|
|
|
|
.build()?)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn build_edit_menu(app: &App) -> MenuResult {
|
|
|
|
|
Ok(SubmenuBuilder::new(app, "Edit")
|
|
|
|
|
.undo()
|
|
|
|
|
.redo()
|
|
|
|
|
.separator()
|
|
|
|
|
.cut()
|
|
|
|
|
.copy()
|
|
|
|
|
.paste()
|
|
|
|
|
.separator()
|
|
|
|
|
.select_all()
|
|
|
|
|
.build()?)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn build_view_menu(app: &App) -> MenuResult {
|
|
|
|
|
let editor_only = MenuItemBuilder::new("Editor Only")
|
|
|
|
|
.id(VIEW_EDITOR_ONLY)
|
|
|
|
|
.accelerator("CmdOrCtrl+1")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let editor_list = MenuItemBuilder::new("Editor + Notes")
|
|
|
|
|
.id(VIEW_EDITOR_LIST)
|
|
|
|
|
.accelerator("CmdOrCtrl+2")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let all_panels = MenuItemBuilder::new("All Panels")
|
|
|
|
|
.id(VIEW_ALL)
|
|
|
|
|
.accelerator("CmdOrCtrl+3")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let toggle_inspector = MenuItemBuilder::new("Toggle Inspector")
|
|
|
|
|
.id(VIEW_TOGGLE_INSPECTOR)
|
|
|
|
|
.build(app)?;
|
|
|
|
|
let command_palette = MenuItemBuilder::new("Command Palette")
|
|
|
|
|
.id(VIEW_COMMAND_PALETTE)
|
|
|
|
|
.accelerator("CmdOrCtrl+K")
|
|
|
|
|
.build(app)?;
|
|
|
|
|
|
|
|
|
|
Ok(SubmenuBuilder::new(app, "View")
|
|
|
|
|
.item(&editor_only)
|
|
|
|
|
.item(&editor_list)
|
|
|
|
|
.item(&all_panels)
|
|
|
|
|
.separator()
|
|
|
|
|
.item(&toggle_inspector)
|
|
|
|
|
.separator()
|
|
|
|
|
.item(&command_palette)
|
|
|
|
|
.build()?)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn build_window_menu(app: &App) -> MenuResult {
|
|
|
|
|
Ok(SubmenuBuilder::new(app, "Window")
|
|
|
|
|
.minimize()
|
|
|
|
|
.maximize()
|
|
|
|
|
.separator()
|
|
|
|
|
.close_window()
|
|
|
|
|
.build()?)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn setup_menu(app: &App) -> Result<(), Box<dyn std::error::Error>> {
|
|
|
|
|
let app_menu = build_app_menu(app)?;
|
|
|
|
|
let file_menu = build_file_menu(app)?;
|
|
|
|
|
let edit_menu = build_edit_menu(app)?;
|
|
|
|
|
let view_menu = build_view_menu(app)?;
|
|
|
|
|
let window_menu = build_window_menu(app)?;
|
2026-02-22 18:44:54 +01:00
|
|
|
|
2026-02-25 18:30:20 +01:00
|
|
|
let menu = MenuBuilder::new(app)
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
.item(&app_menu)
|
|
|
|
|
.item(&file_menu)
|
|
|
|
|
.item(&edit_menu)
|
|
|
|
|
.item(&view_menu)
|
|
|
|
|
.item(&window_menu)
|
2026-02-25 18:30:20 +01:00
|
|
|
.build()?;
|
2026-02-22 18:44:54 +01:00
|
|
|
|
|
|
|
|
app.set_menu(menu)?;
|
|
|
|
|
|
|
|
|
|
app.on_menu_event(|app_handle, event| {
|
|
|
|
|
let id = event.id().0.as_str();
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
if CUSTOM_IDS.contains(&id) {
|
2026-02-22 18:44:54 +01:00
|
|
|
let _ = app_handle.emit("menu-event", id);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
feat: populate macOS menu bar with native menus (File, Edit, View, Window) (#77)
* feat: populate macOS menu bar with File, Edit, View, Window menus
Add complete native macOS menu structure with all app actions:
- Laputa menu: About, Settings (Cmd+,), Hide/Quit
- File: New Note (Cmd+N), Quick Open (Cmd+P), Save (Cmd+S), Close Tab (Cmd+W)
- Edit: standard Undo/Redo/Cut/Copy/Paste/Select All
- View: Editor Only (Cmd+1), Editor+Notes (Cmd+2), All Panels (Cmd+3),
Toggle Inspector, Command Palette (Cmd+K)
- Window: Minimize, Maximize, Close Window
All accelerators registered via Tauri menu API. Menu events dispatched
to frontend via useMenuEvents hook. Save/Close Tab items dynamically
disabled when no note tab is active.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: wrap Enter selection assertion in waitFor for effect re-registration
* fix: resolve rebase conflict markers in menu.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 20:05:24 +01:00
|
|
|
|
|
|
|
|
/// Enable or disable menu items that depend on having an active note tab.
|
|
|
|
|
pub fn set_note_items_enabled(app_handle: &AppHandle, enabled: bool) {
|
|
|
|
|
let Some(menu) = app_handle.menu() else {
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
for id in NOTE_DEPENDENT_IDS {
|
|
|
|
|
if let Some(MenuItemKind::MenuItem(mi)) = menu.get(*id) {
|
|
|
|
|
let _ = mi.set_enabled(enabled);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
mod tests {
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn custom_ids_include_all_expected_items() {
|
|
|
|
|
let expected = [
|
|
|
|
|
"app-settings",
|
|
|
|
|
"file-new-note",
|
|
|
|
|
"file-quick-open",
|
|
|
|
|
"file-save",
|
|
|
|
|
"file-close-tab",
|
|
|
|
|
"view-editor-only",
|
|
|
|
|
"view-editor-list",
|
|
|
|
|
"view-all",
|
|
|
|
|
"view-toggle-inspector",
|
|
|
|
|
"view-command-palette",
|
|
|
|
|
];
|
|
|
|
|
for id in &expected {
|
|
|
|
|
assert!(CUSTOM_IDS.contains(id), "missing custom ID: {id}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn note_dependent_ids_are_subset_of_custom_ids() {
|
|
|
|
|
for id in NOTE_DEPENDENT_IDS {
|
|
|
|
|
assert!(
|
|
|
|
|
CUSTOM_IDS.contains(id),
|
|
|
|
|
"note-dependent ID {id} not in CUSTOM_IDS"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|