test: overlay

This commit is contained in:
2025-07-08 08:45:28 +02:00
parent 4fbce4cd0a
commit 33bd75eeee
2 changed files with 43 additions and 3 deletions

View File

@@ -6,6 +6,7 @@ use std::path::PathBuf;
use sysinfo::System;
use tauri::AppHandle;
use tauri::Emitter;
use tauri::Manager;
use tokio::fs;
use tokio::io::AsyncWriteExt;
use tokio::process::Command;
@@ -638,4 +639,41 @@ pub fn exit(app: AppHandle) {
#[tauri::command]
pub fn get_platform() -> String {
std::env::consts::OS.to_string()
}
}
#[tauri::command]
pub fn show_overlay(app: tauri::AppHandle) -> Result<(), String> {
if !app.webview_windows().contains_key("overlay") {
tauri::WebviewWindowBuilder::new(
&app,
"overlay",
tauri::WebviewUrl::App("/overlay".into()),
)
.always_on_top(true)
.transparent(true)
.decorations(false)
.resizable(false)
.minimizable(false)
.fullscreen(true)
.skip_taskbar(true)
.visible(true)
.center()
.build()
.map_err(|e| e.to_string())?;
} else if let Some(overlay) = app.get_webview_window("overlay") {
overlay.show().map_err(|e| e.to_string())?;
}
Ok(())
}
#[tauri::command]
pub fn hide_overlay(app: tauri::AppHandle) -> Result<(), String> {
if app.webview_windows().contains_key("overlay")
&& let Some(overlay) = app.get_webview_window("overlay")
{
overlay.show().map_err(|e| e.to_string())?;
}
Ok(())
}