Files
Lumotia/src-tauri/src/tray.rs
Claude 89c63891fa chore: rebrand from Kon/Corbie to Magnotia
Replace all instances of the legacy product names "Kon" and "Corbie" with
"Magnotia" across user-facing copy, code identifiers, package names, bundle
ids, file paths, and documentation. Preserves the unrelated "konsole" (KDE
terminal) reference and the parent CORBEL company name.

- Renames 10 Rust crates (kon-* → magnotia-*) and the tauri binary
- Updates package.json, tauri.conf.json (productName + identifier)
- Renames CSS classes (kon-rh-* → magnotia-rh-*) and animations
- Renames brand and roadmap docs
- Regenerates Cargo.lock and package-lock.json

Verified: svelte-check passes; pure-rust crates compile under new names.
2026-04-30 13:06:55 +00:00

74 lines
2.5 KiB
Rust

use tauri::image::Image;
use tauri::menu::{MenuBuilder, MenuItemBuilder};
use tauri::tray::TrayIconBuilder;
use tauri::{Emitter, Manager};
pub fn setup(app: &tauri::App) -> Result<(), Box<dyn std::error::Error>> {
let show = MenuItemBuilder::with_id("show", "Show Magnotia").build(app)?;
let status = MenuItemBuilder::with_id("status", "Ready")
.enabled(false)
.build(app)?;
// Phase 5: always-visible shortcut into the evening wind-down page.
// The page itself only renders once the user has enabled the
// ritual; clicking this when disabled is harmless (just takes them
// there), and Settings is where the toggle lives.
let wind_down = MenuItemBuilder::with_id("wind-down", "Evening wind-down").build(app)?;
let quit = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
let menu = MenuBuilder::new(app)
.item(&show)
.separator()
.item(&status)
.separator()
.item(&wind_down)
.separator()
.item(&quit)
.build()?;
let icon = app
.default_window_icon()
.cloned()
.unwrap_or_else(|| Image::new(&[0u8; 4], 1, 1));
let _tray = TrayIconBuilder::new()
.icon(icon)
.tooltip("Magnotia — Ready")
.menu(&menu)
.on_menu_event(move |app, event| match event.id().as_ref() {
"show" => {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.set_focus();
}
}
"wind-down" => {
if let Some(window) = app.get_webview_window("main") {
let _ = window.show();
let _ = window.set_focus();
}
// The frontend layout listens for this event and routes
// to the Phase 5 wind-down page.
let _ = app.emit("magnotia:open-wind-down", ());
}
"quit" => {
app.exit(0);
}
_ => {}
})
.on_tray_icon_event(|tray, event| {
if let tauri::tray::TrayIconEvent::Click {
button: tauri::tray::MouseButton::Left,
..
} = event
{
if let Some(window) = tray.app_handle().get_webview_window("main") {
let _ = window.show();
let _ = window.set_focus();
}
}
})
.build(app)?;
Ok(())
}