All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m22s
On Windows the miniplayer is now a window of its own (mini.rs, mini.html): a borderless window owned by the main one that the video moves into (VideoSurface::set_host swaps composition targets in one commit). Dragging moves the whole window, so video and controls move together with no edge flicker; release glides it to the nearest corner or the one it's flicked towards, remembered, and it follows the main window. Its page mirrors the player over events (mini:state / mini:action). Shown and hidden natively without activation, so the main window keeps focus. macOS keeps the in-page miniplayer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
86 lines
3.3 KiB
Rust
86 lines
3.3 KiB
Rust
mod diagnostics;
|
|
mod downloads;
|
|
mod mini;
|
|
mod mpv;
|
|
mod platform;
|
|
mod player;
|
|
mod system;
|
|
|
|
use tauri::{Manager, WindowEvent};
|
|
|
|
pub fn run() {
|
|
tauri::Builder::default()
|
|
.plugin(tauri_plugin_http::init())
|
|
.plugin(tauri_plugin_dialog::init())
|
|
.plugin(tauri_plugin_opener::init())
|
|
.plugin(tauri_plugin_updater::Builder::new().build())
|
|
.plugin(tauri_plugin_process::init())
|
|
.plugin(
|
|
tauri_plugin_window_state::Builder::default()
|
|
// The miniplayer window is always placed from the main window (mini.rs).
|
|
.with_denylist(&["mini"])
|
|
.with_state_flags(
|
|
tauri_plugin_window_state::StateFlags::SIZE
|
|
| tauri_plugin_window_state::StateFlags::POSITION
|
|
| tauri_plugin_window_state::StateFlags::MAXIMIZED,
|
|
)
|
|
.build(),
|
|
)
|
|
.manage(player::PlayerState::default())
|
|
.manage(mini::MiniState::default())
|
|
.manage(downloads::Downloads::default())
|
|
.setup(|app| {
|
|
let handle = app.handle().clone();
|
|
diagnostics::start(&handle);
|
|
downloads::restore(&handle);
|
|
if let Some(window) = app.get_webview_window("main") {
|
|
let w = window.clone();
|
|
window.on_window_event(move |event| {
|
|
// On the UI thread: places the miniplayer window without waiting on anything.
|
|
if let WindowEvent::Moved(_) | WindowEvent::Resized(_) | WindowEvent::ScaleFactorChanged { .. } = event {
|
|
mini::follow_main(&w);
|
|
}
|
|
if let WindowEvent::Resized(_) | WindowEvent::ScaleFactorChanged { .. } = event {
|
|
// Never on the UI thread: the player's locks may be held by a
|
|
// command that is itself waiting on the UI thread (see player.rs).
|
|
let w = w.clone();
|
|
tauri::async_runtime::spawn_blocking(move || player::on_resize(&w));
|
|
}
|
|
});
|
|
}
|
|
Ok(())
|
|
})
|
|
.invoke_handler(tauri::generate_handler![
|
|
player::player_init,
|
|
player::player_show,
|
|
player::player_rect,
|
|
player::player_command,
|
|
player::player_set,
|
|
player::player_get,
|
|
player::window_buttons,
|
|
system::secret_get,
|
|
system::secret_set,
|
|
system::secret_delete,
|
|
system::app_info,
|
|
system::dev_session,
|
|
system::keep_awake,
|
|
system::disk_space,
|
|
system::save_url,
|
|
downloads::download_start,
|
|
downloads::download_pause,
|
|
downloads::download_resume,
|
|
downloads::download_remove,
|
|
downloads::download_list,
|
|
downloads::download_set_dir,
|
|
downloads::download_write_meta,
|
|
mini::mini_show,
|
|
mini::mini_hide,
|
|
mini::mini_drag_start,
|
|
mini::mini_drag,
|
|
mini::mini_snap,
|
|
diagnostics::debug_freeze_ui,
|
|
diagnostics::debug_crash,
|
|
])
|
|
.run(tauri::generate_context!())
|
|
.expect("error while running Kaleido");
|
|
}
|