mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
feat: add menu item
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use crate::{
|
||||
app::window,
|
||||
conf::{self, ChatConfJson},
|
||||
utils,
|
||||
};
|
||||
@@ -69,6 +70,9 @@ pub fn init(chat_conf: &conf::ChatConfJson, context: &Context<EmbeddedAssets>) -
|
||||
always_on_top_menu.into(),
|
||||
#[cfg(target_os = "macos")]
|
||||
titlebar_menu.into(),
|
||||
CustomMenuItem::new("switch_origin".to_string(), "Switch Origin")
|
||||
.accelerator("CmdOrCtrl+O")
|
||||
.into(),
|
||||
CustomMenuItem::new("inject_script".to_string(), "Inject Script")
|
||||
.accelerator("CmdOrCtrl+J")
|
||||
.into(),
|
||||
@@ -152,6 +156,10 @@ pub fn menu_handler(event: WindowMenuEvent<tauri::Wry>) {
|
||||
// Preferences
|
||||
"inject_script" => open(&app, script_path),
|
||||
"awesome" => open(&app, conf::AWESOME_URL.to_string()),
|
||||
"switch_origin" => {
|
||||
window::origin_window(&app);
|
||||
// app.get_window("origin").unwrap().show();
|
||||
}
|
||||
"titlebar" => {
|
||||
let chat_conf = conf::ChatConfJson::get_chat_conf();
|
||||
ChatConfJson::amend(&serde_json::json!({ "titlebar": !chat_conf.titlebar })).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user