✨ add jump url to anywhere
This commit is contained in:
@@ -10,6 +10,7 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags};
|
||||
|
||||
pub fn get_menu() -> Menu {
|
||||
let close = CustomMenuItem::new("close".to_string(), "Close Window").accelerator("CmdOrCtrl+W");
|
||||
let goto_url_item = CustomMenuItem::new("goto_url".to_string(), "Go to URL...").accelerator("CmdOrCtrl+Shift+L");
|
||||
let first_menu = Menu::new()
|
||||
.add_native_item(MenuItem::Copy)
|
||||
.add_native_item(MenuItem::Cut)
|
||||
@@ -18,6 +19,8 @@ pub fn get_menu() -> Menu {
|
||||
.add_native_item(MenuItem::Redo)
|
||||
.add_native_item(MenuItem::SelectAll)
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_item(goto_url_item)
|
||||
.add_native_item(MenuItem::Separator)
|
||||
.add_native_item(MenuItem::EnterFullScreen)
|
||||
.add_native_item(MenuItem::Minimize)
|
||||
.add_native_item(MenuItem::Hide)
|
||||
@@ -35,6 +38,11 @@ pub fn menu_event_handle(event: WindowMenuEvent) {
|
||||
if event.menu_item_id() == "close" {
|
||||
event.window().minimize().expect("can't minimize window");
|
||||
}
|
||||
|
||||
if event.menu_item_id() == "goto_url" {
|
||||
let js_code = "showUrlModal();";
|
||||
event.window().eval(js_code).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||
@@ -85,7 +93,6 @@ pub fn system_tray_handle(app: &tauri::AppHandle, event: SystemTrayEvent) {
|
||||
}
|
||||
"quit" => {
|
||||
let _res = app.save_window_state(StateFlags::all());
|
||||
// println!("save windows state result {:?}", _res);
|
||||
std::process::exit(0);
|
||||
}
|
||||
"about" => {
|
||||
|
||||
@@ -27,7 +27,8 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
|
||||
.fullscreen(window_config.fullscreen)
|
||||
.inner_size(window_config.width, window_config.height)
|
||||
.initialization_script(include_str!("../inject/style.js"))
|
||||
.initialization_script(include_str!("../inject/index.js"));
|
||||
.initialization_script(include_str!("../inject/index.js"))
|
||||
.initialization_script(include_str!("../inject/component.js"));
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user