Files
spaceshell/app/src-tauri/src/lib.rs
T
vasyansk f9a565a712 feat(app): clear all events from the Event Center (red trash icon)
Adds Cmd::ClearEvents + Evt::EventsCleared: the daemon drops the persistent
event log (keeping next_id monotonic), persists, and broadcasts so every
client empties its list. A red trash icon next to 'Mark all read' triggers it;
disabled when the list is empty. Threaded through proto, the daemon handler,
the Tauri bridge, and socketBridge. Includes an EventLog::clear test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 13:38:35 +07:00

64 lines
2.3 KiB
Rust

mod bridge;
use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
// Persist + restore the window's size, position and maximized state across restarts.
.plugin(tauri_plugin_window_state::Builder::default().build())
.plugin(tauri_plugin_notification::init())
.setup(|app| {
let handle = app.handle().clone();
// Connect the bridge on a tokio runtime, then manage it.
tauri::async_runtime::block_on(async move {
match bridge::Bridge::connect(handle.clone()).await {
Ok(bridge) => {
handle.manage(bridge);
}
// Don't crash the app — open the window and log. Commands will
// error until a daemon is reachable; start it manually
// (./target/debug/spaceshd) or set SPACESHD_BIN / SPACESH_SOCK.
Err(e) => {
eprintln!(
"spacesh: could not connect to spaceshd: {e}\
start it manually or set SPACESHD_BIN/SPACESH_SOCK"
);
}
}
});
Ok(())
})
.invoke_handler(tauri::generate_handler![
bridge::open,
bridge::new_surface,
bridge::input,
bridge::resize,
bridge::attach,
bridge::detach,
bridge::status,
bridge::close_surface,
bridge::split_surface,
bridge::set_ratios,
bridge::move_surface,
bridge::apply_preset,
bridge::restart_surface,
bridge::close_workspace,
bridge::set_workspace_meta,
bridge::create_group,
bridge::set_group,
bridge::delete_group,
bridge::focus,
bridge::set_zoom,
bridge::event_log,
bridge::mark_read,
bridge::clear_events,
bridge::health,
bridge::get_config,
bridge::set_config,
bridge::shutdown_daemon,
])
.run(tauri::generate_context!())
.expect("error while running spacesh");
}