Initial RuneStone project
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
mod pty;
|
||||
mod workspace;
|
||||
|
||||
use pty::PtyState;
|
||||
use tauri::Manager;
|
||||
use workspace::WorkspaceState;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.manage(WorkspaceState::new())
|
||||
.manage(PtyState::new())
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
workspace::workspace_open,
|
||||
workspace::workspace_open_window,
|
||||
workspace::workspace_last_path,
|
||||
workspace::workspace_recent,
|
||||
workspace::workspace_new,
|
||||
workspace::workspace_list,
|
||||
workspace::workspace_read,
|
||||
workspace::workspace_write,
|
||||
workspace::workspace_create,
|
||||
workspace::workspace_rename,
|
||||
workspace::workspace_delete,
|
||||
workspace::workspace_read_data_url,
|
||||
workspace::workspace_write_bytes,
|
||||
workspace::workspace_copy,
|
||||
workspace::workspace_abs_path,
|
||||
workspace::workspace_reveal,
|
||||
workspace::workspace_search,
|
||||
pty::pty_open,
|
||||
pty::pty_write,
|
||||
pty::pty_resize,
|
||||
pty::pty_close,
|
||||
pty::pty_profiles,
|
||||
pty::pty_new_window,
|
||||
pty::pty_dictation,
|
||||
])
|
||||
.build(tauri::generate_context!())
|
||||
.expect("error while building tauri application")
|
||||
.run(|app, event| {
|
||||
if let tauri::RunEvent::WindowEvent { label, event: tauri::WindowEvent::Destroyed, .. } = &event {
|
||||
app.state::<PtyState>().close_window(label);
|
||||
app.state::<WorkspaceState>().close_window(label);
|
||||
}
|
||||
if matches!(event, tauri::RunEvent::Exit) {
|
||||
app.state::<PtyState>().close_all();
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user