🐛 Close minimize to hide in mac
This commit is contained in:
4
script/build_with_pake_cli.js
vendored
4
script/build_with_pake_cli.js
vendored
@@ -47,10 +47,6 @@ if (process.platform === 'linux') {
|
|||||||
params = `${params} --show-system-tray`;
|
params = `${params} --show-system-tray`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'darwin') {
|
|
||||||
params = `${params} --show-menu`;
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadIcon = async iconFile => {
|
const downloadIcon = async iconFile => {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(process.env.ICON, { responseType: 'arraybuffer' });
|
const response = await axios.get(process.env.ICON, { responseType: 'arraybuffer' });
|
||||||
|
|||||||
@@ -1,42 +1,31 @@
|
|||||||
#![cfg_attr(
|
#![cfg_attr(
|
||||||
all(not(debug_assertions), target_os = "windows"),
|
all(not(debug_assertions), target_os = "windows"),
|
||||||
windows_subsystem = "windows"
|
windows_subsystem = "windows"
|
||||||
)]
|
)]
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use app::{invoke, menu, window};
|
use app::{invoke, window, menu};
|
||||||
use invoke::{download_file, download_file_by_binary};
|
use invoke::{download_file, download_file_by_binary};
|
||||||
use menu::{get_menu, menu_event_handle};
|
use menu::{get_system_tray, system_tray_handle};
|
||||||
use tauri_plugin_window_state::Builder as windowStatePlugin;
|
use tauri_plugin_window_state::Builder as windowStatePlugin;
|
||||||
use util::{get_data_dir, get_pake_config};
|
use util::{get_data_dir, get_pake_config};
|
||||||
use window::get_window;
|
use window::get_window;
|
||||||
|
|
||||||
pub fn run_app() {
|
pub fn run_app() {
|
||||||
let (pake_config, tauri_config) = get_pake_config();
|
let (pake_config, tauri_config) = get_pake_config();
|
||||||
let show_menu = pake_config.show_menu();
|
|
||||||
let menu = get_menu();
|
|
||||||
let data_dir = get_data_dir(tauri_config);
|
let data_dir = get_data_dir(tauri_config);
|
||||||
|
|
||||||
let mut tauri_app = tauri::Builder::default();
|
let mut tauri_app = tauri::Builder::default();
|
||||||
|
|
||||||
if show_menu {
|
let show_system_tray = pake_config.show_system_tray();
|
||||||
tauri_app = tauri_app.menu(menu).on_menu_event(menu_event_handle);
|
let system_tray = get_system_tray();
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
if show_system_tray {
|
||||||
{
|
tauri_app = tauri_app
|
||||||
use menu::{get_system_tray, system_tray_handle};
|
.system_tray(system_tray)
|
||||||
|
.on_system_tray_event(system_tray_handle);
|
||||||
let show_system_tray = pake_config.show_system_tray();
|
|
||||||
let system_tray = get_system_tray(show_menu);
|
|
||||||
|
|
||||||
if show_system_tray {
|
|
||||||
tauri_app = tauri_app
|
|
||||||
.system_tray(system_tray)
|
|
||||||
.on_system_tray_event(system_tray_handle);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tauri_app
|
tauri_app
|
||||||
@@ -57,6 +46,7 @@ pub fn run_app() {
|
|||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
event.window().minimize().unwrap();
|
event.window().minimize().unwrap();
|
||||||
|
event.window().hide().unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
|||||||
Reference in New Issue
Block a user