mirror of
https://github.com/FranP-code/ChatGPT.git
synced 2025-10-13 00:13:25 +00:00
chore: icon & global shortcuts
This commit is contained in:
@@ -74,7 +74,7 @@ cask "popcorn-time", args: { "no-quarantine": true }
|
||||
- 系统托盘悬浮窗
|
||||
- 应用菜单功能强大
|
||||
- 支持斜杠命令及其配置(可手动配置或从文件同步 [#55](https://github.com/lencx/ChatGPT/issues/55))
|
||||
<!-- - 进入应用的全局快捷键 (mac: `command+shift+o`, windows: `ctrl+shift+o`) -->
|
||||
- 进入应用的全局快捷键 (mac: `Command + Shift + O`, windows: `Ctrl + Shift + O`)
|
||||
|
||||
### 菜单项
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ In the chatgpt text input area, type a character starting with `/` to bring up t
|
||||
- System tray hover window
|
||||
- Powerful menu items
|
||||
- Support for slash commands and their configuration (can be configured manually or synchronized from a file [#55](https://github.com/lencx/ChatGPT/issues/55))
|
||||
<!-- - Global shortcuts to the chatgpt app (mac: `command+shift+o`, windows: `ctrl+shift+o`) -->
|
||||
- Global shortcuts to the chatgpt app (mac: `Command + Shift + O`, windows: `Ctrl + Shift + O`)
|
||||
|
||||
### MenuItem
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# UPDATE LOG
|
||||
|
||||
## v0.7.3
|
||||
|
||||
chore:
|
||||
- optimize tray menu icon and button icons
|
||||
- global shortcuts to the chatgpt app (mac: `Command + Shift + O`, windows: `Ctrl + Shift + O`)
|
||||
|
||||
## v0.7.2
|
||||
|
||||
fix: some windows systems cannot start the application
|
||||
|
||||
@@ -17,7 +17,7 @@ tauri-build = {version = "1.2.1", features = [] }
|
||||
anyhow = "1.0.66"
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.2.3", features = ["api-all", "devtools", "system-tray", "updater"] }
|
||||
tauri = { version = "1.2.3", features = ["api-all", "devtools", "global-shortcut", "system-tray", "updater"] }
|
||||
tauri-plugin-positioner = { version = "1.0.4", features = ["system-tray"] }
|
||||
log = "0.4.17"
|
||||
csv = "1.1.6"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use crate::{app::window, conf::ChatConfJson, utils};
|
||||
use log::info;
|
||||
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, Manager};
|
||||
use tauri::{utils::config::WindowUrl, window::WindowBuilder, App, GlobalShortcutManager, Manager};
|
||||
|
||||
pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
info!("stepup");
|
||||
let chat_conf = ChatConfJson::get_chat_conf();
|
||||
let url = chat_conf.origin.to_string();
|
||||
let theme = ChatConfJson::theme();
|
||||
@@ -12,31 +13,30 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box<dyn std::error::Error>
|
||||
window::tray_window(&handle);
|
||||
});
|
||||
|
||||
info!("stepup");
|
||||
{
|
||||
info!("global_shortcut_start");
|
||||
let handle = app.app_handle();
|
||||
let mut shortcut = app.global_shortcut_manager();
|
||||
let core_shortcut = shortcut.is_registered("CmdOrCtrl+Shift+O");
|
||||
|
||||
// fix: Global shortcuts can cause programs to exit under windows
|
||||
// {
|
||||
// info!("global_shortcut_start");
|
||||
// let handle = app.app_handle();
|
||||
// let mut shortcut = app.global_shortcut_manager();
|
||||
// let is_mini_key = shortcut.is_registered("CmdOrCtrl+Shift+O");
|
||||
info!("is_registered: {}", core_shortcut.is_ok());
|
||||
|
||||
// if is_mini_key.is_ok() {
|
||||
// shortcut
|
||||
// .register("CmdOrCtrl+Shift+O", move || {
|
||||
// if let Some(w) = handle.get_window("core") {
|
||||
// if w.is_visible().unwrap() {
|
||||
// w.hide().unwrap();
|
||||
// } else {
|
||||
// w.show().unwrap();
|
||||
// w.set_focus().unwrap();
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// .unwrap();
|
||||
// };
|
||||
// info!("global_shortcut_end");
|
||||
// }
|
||||
if core_shortcut.is_ok() {
|
||||
shortcut
|
||||
.register("CmdOrCtrl+Shift+O", move || {
|
||||
if let Some(w) = handle.get_window("core") {
|
||||
if w.is_visible().unwrap() {
|
||||
w.hide().unwrap();
|
||||
} else {
|
||||
w.show().unwrap();
|
||||
w.set_focus().unwrap();
|
||||
}
|
||||
}
|
||||
})
|
||||
.unwrap();
|
||||
};
|
||||
info!("global_shortcut_end");
|
||||
}
|
||||
|
||||
if chat_conf.hide_dock_icon {
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use crate::utils::{chat_root, create_file, exists};
|
||||
use anyhow::Result;
|
||||
use log::info;
|
||||
use serde_json::Value;
|
||||
use std::{collections::BTreeMap, fs, path::PathBuf, sync::Mutex};
|
||||
use tauri::{Manager, Theme};
|
||||
@@ -7,8 +8,8 @@ use tauri::{Manager, Theme};
|
||||
#[cfg(target_os = "macos")]
|
||||
use tauri::TitleBarStyle;
|
||||
|
||||
// pub const USER_AGENT: &str = "5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36";
|
||||
// pub const PHONE_USER_AGENT: &str = "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1";
|
||||
// pub const USER_AGENT: &str = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15";
|
||||
// pub const PHONE_USER_AGENT: &str = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Mobile/15E148 Safari/604.1";
|
||||
|
||||
pub const ISSUES_URL: &str = "https://github.com/lencx/ChatGPT/issues";
|
||||
pub const UPDATE_LOG_URL: &str = "https://github.com/lencx/ChatGPT/blob/main/UPDATE_LOG.md";
|
||||
@@ -66,6 +67,7 @@ impl ChatConfJson {
|
||||
/// init chat.conf.json
|
||||
/// path: ~/.chatgpt/chat.conf.json
|
||||
pub fn init() -> PathBuf {
|
||||
info!("chat_conf_init");
|
||||
let conf_file = ChatConfJson::conf_path();
|
||||
let content = if cfg!(target_os = "macos") {
|
||||
DEFAULT_CHAT_CONF_MAC
|
||||
|
||||
Reference in New Issue
Block a user