feat: custom window decorations

This commit is contained in:
GyDi
2022-01-08 22:23:48 +08:00
parent 2d2899b68a
commit ed6bfa5fa2
10 changed files with 194 additions and 648 deletions

View File

@@ -8,7 +8,7 @@ use crate::{
},
};
use serde_yaml::Mapping;
use tauri::State;
use tauri::{AppHandle, Manager, State};
/// get all profiles from `profiles.yaml`
/// do not acquire the lock of ProfileLock
@@ -246,3 +246,25 @@ pub async fn patch_verge_config(
verge.config.save_file()
}
/// start dragging window
#[tauri::command]
pub fn win_drag(app_handle: AppHandle) {
let window = app_handle.get_window("main").unwrap();
window.start_dragging().unwrap();
}
/// hide the window
#[tauri::command]
pub fn win_hide(app_handle: AppHandle) {
let window = app_handle.get_window("main").unwrap();
window.hide().unwrap();
}
/// mini the window
#[tauri::command]
pub fn win_mini(app_handle: AppHandle) {
let window = app_handle.get_window("main").unwrap();
// todo: these methods still has bug on Windows
window.minimize().unwrap();
}