From 9cacad01207df7eed190449b1c5dcb03c37cf270 Mon Sep 17 00:00:00 2001 From: lencx Date: Thu, 29 Dec 2022 21:05:21 +0800 Subject: [PATCH] chore: optim style --- UPDATE_LOG.md | 1 + src-tauri/src/app/menu.rs | 28 ++++++++++++++++++++-------- src-tauri/src/assets/cmd.js | 26 ++++++++++++++++++++------ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/UPDATE_LOG.md b/UPDATE_LOG.md index 40d00f5..31259e6 100644 --- a/UPDATE_LOG.md +++ b/UPDATE_LOG.md @@ -3,6 +3,7 @@ ## v0.7.3 chore: +- optimize slash command style - optimize tray menu icon and button icons - global shortcuts to the chatgpt app (mac: `Command + Shift + O`, windows: `Ctrl + Shift + O`) diff --git a/src-tauri/src/app/menu.rs b/src-tauri/src/app/menu.rs index 93d87bf..690860f 100644 --- a/src-tauri/src/app/menu.rs +++ b/src-tauri/src/app/menu.rs @@ -279,20 +279,32 @@ pub fn menu_handler(event: WindowMenuEvent) { // --- SystemTray Menu pub fn tray_menu() -> SystemTray { + if cfg!(target_os = "macos") { + return SystemTray::new().with_menu( + SystemTrayMenu::new() + .add_item(CustomMenuItem::new( + "control_center".to_string(), + "Control Center", + )) + .add_item(CustomMenuItem::new( + "show_dock_icon".to_string(), + "Show Dock Icon", + )) + .add_item(CustomMenuItem::new( + "hide_dock_icon".to_string(), + "Hide Dock Icon", + )) + .add_native_item(SystemTrayMenuItem::Separator) + .add_item(CustomMenuItem::new("quit".to_string(), "Quit ChatGPT")), + ); + } + SystemTray::new().with_menu( SystemTrayMenu::new() .add_item(CustomMenuItem::new( "control_center".to_string(), "Control Center", )) - .add_item(CustomMenuItem::new( - "show_dock_icon".to_string(), - "Show Dock Icon", - )) - .add_item(CustomMenuItem::new( - "hide_dock_icon".to_string(), - "Hide Dock Icon", - )) .add_native_item(SystemTrayMenuItem::Separator) .add_item(CustomMenuItem::new("quit".to_string(), "Quit ChatGPT")), ) diff --git a/src-tauri/src/assets/cmd.js b/src-tauri/src/assets/cmd.js index 245454f..6c712d1 100644 --- a/src-tauri/src/assets/cmd.js +++ b/src-tauri/src/assets/cmd.js @@ -13,13 +13,30 @@ function init() { z-index: 9999; } .chat-model-cmd-list>div { - border: solid 2px #d8d8d8; + border: solid 2px rgba(80,80,80,.3); border-radius: 5px; background-color: #fff; } + + html.dark .chat-model-cmd-list>div { + background-color: #4a4a4a; + } + html.dark .chat-model-cmd-list .cmd-item { + border-color: #666; + } + html.dark .chat-model-cmd-list .cmd-item b { + color: #e8e8e8; + } + html.dark .chat-model-cmd-list .cmd-item i { + color: #999; + } + html.dark .chat-model-cmd-list .cmd-item.selected { + background: rgba(59,130,246,.5); + } + .chat-model-cmd-list .cmd-item { font-size: 12px; - border-bottom: solid 1px #888; + border-bottom: solid 1px rgba(80,80,80,.2); padding: 2px 4px; display: flex; user-select: none; @@ -29,7 +46,7 @@ function init() { border-bottom: none; } .chat-model-cmd-list .cmd-item.selected { - background: #fea; + background: rgba(59,130,246,.3); } .chat-model-cmd-list .cmd-item b { display: inline-block; @@ -173,9 +190,6 @@ async function cmdTip() { delete window.__CHAT_MODEL_CMD_PROMPT__; } - console.log('«174» /src/assets/cmd.js ~> ', window.__CHAT_MODEL_CMD_PROMPT__); - - // ------------------ send -------------------------------------------------------------------- if (event.keyCode === 13 && window.__CHAT_MODEL_CMD_PROMPT__) { // Enter const data = searchInput.value.split('|->');