Files
infinite/src-tauri/src/lib.rs
2026-05-15 11:57:12 +00:00

52 lines
1.6 KiB
Rust

mod pty;
mod storage;
use pty::{pty_kill, pty_resize, pty_spawn, pty_write, PtyState};
use storage::{
board_create, board_delete, board_load, board_rename, board_save, boards_load_index,
boards_set_current,
};
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
// webkit2gtk's hardware compositor fails in VMs / on systems without a
// real GPU and the window goes grey. Fall back to software rendering.
#[cfg(target_os = "linux")]
{
if std::env::var_os("WEBKIT_DISABLE_COMPOSITING_MODE").is_none() {
std::env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
}
if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() {
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
}
}
tauri::Builder::default()
.manage(PtyState::default())
.setup(|app| {
if cfg!(debug_assertions) {
app.handle().plugin(
tauri_plugin_log::Builder::default()
.level(log::LevelFilter::Info)
.build(),
)?;
}
Ok(())
})
.invoke_handler(tauri::generate_handler![
pty_spawn,
pty_write,
pty_resize,
pty_kill,
boards_load_index,
board_save,
board_load,
board_create,
board_rename,
board_delete,
boards_set_current,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}