Add custom topbar for windows, and remove flags like right click
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
use sha2::{Digest, Sha512};
|
||||
use std::fs::{remove_dir_all};
|
||||
use std::fs::remove_dir_all;
|
||||
use std::io::Cursor;
|
||||
use std::{
|
||||
fs::{File, create_dir_all},
|
||||
io::{copy},
|
||||
io::copy,
|
||||
path::PathBuf,
|
||||
process::Command
|
||||
process::Command,
|
||||
};
|
||||
use tauri::{AppHandle, Manager};
|
||||
use tauri_plugin_os::platform;
|
||||
use tauri_plugin_prevent_default::Flags;
|
||||
use zip::ZipArchive;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use tauri_plugin_decorum::WebviewWindowExt;
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
|
||||
@@ -127,19 +131,22 @@ fn load(app: AppHandle) {
|
||||
if let Err(_) = Command::new("open")
|
||||
.arg("Lncvrt Games Launcher.app")
|
||||
.current_dir(&bin_path)
|
||||
.spawn() {
|
||||
.spawn()
|
||||
{
|
||||
eprintln!("Failed to launch game on macOS");
|
||||
}
|
||||
} else if platform() == "linux" {
|
||||
if let Err(_) = Command::new("./lncvrt-games-launcher")
|
||||
.current_dir(&bin_path)
|
||||
.spawn() {
|
||||
.spawn()
|
||||
{
|
||||
eprintln!("Failed to launch game on macOS");
|
||||
}
|
||||
} else if platform() == "windows" {
|
||||
if let Err(_) = Command::new(&bin_path.join("lncvrt-games-launcher.exe"))
|
||||
.current_dir(&bin_path)
|
||||
.spawn() {
|
||||
.spawn()
|
||||
{
|
||||
eprintln!("Failed to launch game on macOS");
|
||||
}
|
||||
}
|
||||
@@ -150,7 +157,44 @@ fn load(app: AppHandle) {
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
tauri::Builder::default()
|
||||
.plugin(
|
||||
tauri_plugin_prevent_default::Builder::new()
|
||||
.with_flags(
|
||||
Flags::FIND
|
||||
| Flags::CARET_BROWSING
|
||||
| Flags::DEV_TOOLS
|
||||
| Flags::DOWNLOADS
|
||||
| Flags::FOCUS_MOVE
|
||||
| Flags::RELOAD
|
||||
| Flags::SOURCE
|
||||
| Flags::OPEN
|
||||
| Flags::PRINT
|
||||
| Flags::CONTEXT_MENU,
|
||||
)
|
||||
.build(),
|
||||
)
|
||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||
let _ = app
|
||||
.get_webview_window("main")
|
||||
.expect("no main window")
|
||||
.set_focus();
|
||||
}))
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_decorum::init())
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.setup(|app| {
|
||||
#[cfg(target_os = "windows")]
|
||||
{
|
||||
if let Some(main_window) = app.get_webview_window("main") {
|
||||
if let Err(e) = main_window.create_overlay_titlebar() {
|
||||
eprintln!("Failed to create overlay titlebar: {:?}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let app_local_data_dir = match app.path().app_local_data_dir() {
|
||||
Ok(p) => p,
|
||||
Err(_) => return Ok(()),
|
||||
@@ -175,17 +219,6 @@ pub fn run() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| {
|
||||
let _ = app
|
||||
.get_webview_window("main")
|
||||
.expect("no main window")
|
||||
.set_focus();
|
||||
}))
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_os::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.invoke_handler(tauri::generate_handler![download, load])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user