mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
31 lines
762 B
Rust
31 lines
762 B
Rust
use crate::utils;
|
|
use std::fs;
|
|
use tauri::{api, command, AppHandle, Manager};
|
|
|
|
#[command]
|
|
pub fn drag_window(app: AppHandle) {
|
|
app.get_window("core").unwrap().start_dragging().unwrap();
|
|
}
|
|
|
|
#[command]
|
|
pub fn fullscreen(app: AppHandle) {
|
|
let win = app.get_window("core").unwrap();
|
|
if win.is_fullscreen().unwrap() {
|
|
win.set_fullscreen(false).unwrap();
|
|
} else {
|
|
win.set_fullscreen(true).unwrap();
|
|
}
|
|
}
|
|
|
|
#[command]
|
|
pub fn download(_app: AppHandle, name: String, blob: Vec<u8>) {
|
|
let path = api::path::download_dir().unwrap().join(name);
|
|
fs::write(&path, blob).unwrap();
|
|
utils::open_file(path);
|
|
}
|
|
|
|
#[command]
|
|
pub fn open_link(app: AppHandle, url: String) {
|
|
api::shell::open(&app.shell_scope(), url, None).unwrap();
|
|
}
|