diff --git a/src/locales/en-US.json b/src/locales/en-US.json index 1296d62..7f8b709 100644 --- a/src/locales/en-US.json +++ b/src/locales/en-US.json @@ -150,10 +150,10 @@ "open_source_address": "Open Source Address", "preference": "Preference", "relaunch": "Relaunch", + "screenshot": "Screenshot", "start_listening": "Start Listening", "stop_listening": "Stop listening", - "version": "Version", - "screenshot": "Screenshot" + "version": "Version" } } }, @@ -173,6 +173,10 @@ "authorize": "Authorize", "authorized": "Authorized", "full_disk_access": { + "cancel": "Cancel", + "confirm": "Go to System Settings", + "confirm_message": "Full Disk Access permission needs to be enabled manually in System Settings. Clicking \"Go to System Settings\" will open System Preferences.", + "confirm_title": "Full Disk Access Required", "description": "Used for reading files in protected directories", "title": "Full Disk Access" }, @@ -457,9 +461,9 @@ "general": "General", "history": "History", "privacy": "Privacy", + "screenshot": "Screenshot", "shortcut": "Shortcuts", - "tag": "Tags", - "screenshot": "Screenshot" + "tag": "Tags" } }, "privacy": { @@ -482,6 +486,50 @@ "title": "Privacy Consideration" } }, + "screenshot": { + "editor": { + "action": { + "cancel": "Cancel", + "copy": "Copy", + "redo": "Redo", + "save": "Save", + "send": "Send to Wegent", + "undo": "Undo" + }, + "hint": { + "copy_success": "Copied to clipboard", + "permission_denied": "Screenshot permission denied. Please authorize Screen Recording in System Settings.", + "save_success": "Screenshot saved", + "send_title": "Send Screenshot" + }, + "tool": { + "arrow": "Arrow", + "ellipse": "Ellipse", + "mosaic": "Mosaic", + "pen": "Pen", + "rect": "Rectangle", + "text": "Text" + } + }, + "settings": { + "default_action": { + "copy": "Copy Directly", + "menu": "Show Action Menu", + "save": "Save Directly" + }, + "hints": { + "default_action": "Default action after taking a screenshot", + "save_format": "Image format when saving screenshots", + "save_to_history": "Automatically save screenshot to clipboard history" + }, + "label": { + "default_action": "Default Action After Screenshot", + "save_format": "Save Format", + "save_to_history": "Auto Save to History" + }, + "title": "Screenshot Settings" + } + }, "settings": { "app_settings": { "hints": { @@ -554,8 +602,8 @@ "copy_file_path": "Copy the file path of the selected item to clipboard when the window is activated", "paste_as_plain": "Paste selections as plain text or paths when the window is activated", "quick_paste": "Use number key combos to quickly paste top 9 items when window is hidden", - "send": "Send the selected item to AI API when the window is activated", - "screenshot": "Global shortcut key for taking screenshots" + "screenshot": "Global shortcut key for taking screenshots", + "send": "Send the selected item to AI API when the window is activated" }, "label": { "copy_file_path": "Copy File Path", @@ -563,8 +611,8 @@ "open_settings": "Open Preferences Window", "paste_as_plain": "Paste as Plain Text", "quick_paste": "Quick Paste", - "send": "Send to AI", - "screenshot": "Screenshot" + "screenshot": "Screenshot", + "send": "Send to AI" }, "title": "Shortcuts" } @@ -590,51 +638,7 @@ "trigger_word_placeholder": "e.g., u123", "trigger_word_required": "Please enter a trigger word" }, - "title": "Preferences", - "screenshot": { - "settings": { - "title": "Screenshot Settings", - "label": { - "save_to_history": "Auto Save to History", - "default_action": "Default Action After Screenshot", - "save_format": "Save Format" - }, - "hints": { - "save_to_history": "Automatically save screenshot to clipboard history", - "default_action": "Default action after taking a screenshot", - "save_format": "Image format when saving screenshots" - }, - "default_action": { - "menu": "Show Action Menu", - "copy": "Copy Directly", - "save": "Save Directly" - } - }, - "editor": { - "tool": { - "rect": "Rectangle", - "ellipse": "Ellipse", - "arrow": "Arrow", - "text": "Text", - "pen": "Pen", - "mosaic": "Mosaic" - }, - "action": { - "cancel": "Cancel", - "copy": "Copy", - "save": "Save", - "send": "Send to Wegent", - "undo": "Undo", - "redo": "Redo" - }, - "hint": { - "copy_success": "Copied to clipboard", - "save_success": "Screenshot saved", - "send_title": "Send Screenshot", - "permission_denied": "Screenshot permission denied. Please authorize Screen Recording in System Settings." - } - } - } + "title": "Preferences" }, "tag": { "color_label": "Tag Color", @@ -651,4 +655,4 @@ "name_label": "Tag Name", "name_placeholder": "Enter tag name" } -} \ No newline at end of file +} diff --git a/src/locales/ja-JP.json b/src/locales/ja-JP.json index fb75a36..cbffbc1 100644 --- a/src/locales/ja-JP.json +++ b/src/locales/ja-JP.json @@ -93,10 +93,10 @@ "open_source_address": "ギットハブ", "preference": "プリファレンス", "relaunch": "再開", + "screenshot": "スクリーンショット", "start_listening": "使用を停止", "stop_listening": "使用を再開", - "version": "バージョン", - "screenshot": "スクリーンショット" + "version": "バージョン" } } }, @@ -113,6 +113,10 @@ "authorize": "承認する", "authorized": "承認済み", "full_disk_access": { + "cancel": "キャンセル", + "confirm": "システム設定へ", + "confirm_message": "フルディスクアクセス権限はシステム設定で手動で有効にする必要があります。「システム設定へ」をクリックするとシステム環境設定が開きます。", + "confirm_title": "フルディスクアクセスが必要です", "description": "保護されたパスのファイル読み取りに使用", "title": "フルディスクアクセス" }, @@ -341,8 +345,8 @@ "general": "共通設定", "history": "履歴", "privacy": "プライバシー", - "shortcut": "ショートカットキー", - "screenshot": "スクリーンショット" + "screenshot": "スクリーンショット", + "shortcut": "ショートカットキー" } }, "privacy": { @@ -365,6 +369,50 @@ "title": "プライバシー考慮" } }, + "screenshot": { + "editor": { + "action": { + "cancel": "キャンセル", + "copy": "コピー", + "redo": "やり直す", + "save": "保存", + "send": "Wegentに送信", + "undo": "元に戻す" + }, + "hint": { + "copy_success": "クリップボードにコピーしました", + "permission_denied": "スクリーンショット権限が拒否されました。システム設定で画面録画を許可してください。", + "save_success": "スクリーンショットを保存しました", + "send_title": "スクリーンショットを送信" + }, + "tool": { + "arrow": "Arrow", + "ellipse": "Ellipse", + "mosaic": "Mosaic", + "pen": "Pen", + "rect": "Rectangle", + "text": "Text" + } + }, + "settings": { + "default_action": { + "copy": "直接コピー", + "menu": "アクションメニューを表示", + "save": "直接保存" + }, + "hints": { + "default_action": "スクリーンショット後のデフォルト操作", + "save_format": "スクリーンショット保存時の画像形式", + "save_to_history": "スクリーンショットをクリップボード履歴に自動保存" + }, + "label": { + "default_action": "デフォルトアクション", + "save_format": "保存形式", + "save_to_history": "履歴に自動保存" + }, + "title": "スクリーンショット設定" + } + }, "settings": { "app_settings": { "hints": { @@ -437,8 +485,8 @@ "copy_file_path": "ウィンドウがアクティブな時、選択した項目のファイルパスをクリップボードにコピー", "paste_as_plain": "選択範囲をプレーンテキスト、パスとして貼り付けます。", "quick_paste": "ウィンドウを隠す際、数字キーの組み合わせで最初の9項目を素早く貼り付ける", - "send": "ウィンドウがアクティブな時、選択した内容をAI APIに送信", - "screenshot": "スクリーンショットのグローバルショートカットキー" + "screenshot": "スクリーンショットのグローバルショートカットキー", + "send": "ウィンドウがアクティブな時、選択した内容をAI APIに送信" }, "label": { "copy_file_path": "ファイルパスをコピー", @@ -446,57 +494,13 @@ "open_settings": "クリップボード設定を開く", "paste_as_plain": "プレーンテキストとして貼り付け", "quick_paste": "クイックペースト", - "send": "AIに送信", - "screenshot": "スクリーンショット" + "screenshot": "スクリーンショット", + "send": "AIに送信" }, "title": "ショートカットキー" } }, - "title": "環境設定", - "screenshot": { - "settings": { - "title": "スクリーンショット設定", - "label": { - "save_to_history": "履歴に自動保存", - "default_action": "デフォルトアクション", - "save_format": "保存形式" - }, - "hints": { - "save_to_history": "スクリーンショットをクリップボード履歴に自動保存", - "default_action": "スクリーンショット後のデフォルト操作", - "save_format": "スクリーンショット保存時の画像形式" - }, - "default_action": { - "menu": "アクションメニューを表示", - "copy": "直接コピー", - "save": "直接保存" - } - }, - "editor": { - "tool": { - "rect": "Rectangle", - "ellipse": "Ellipse", - "arrow": "Arrow", - "text": "Text", - "pen": "Pen", - "mosaic": "Mosaic" - }, - "action": { - "cancel": "キャンセル", - "copy": "コピー", - "save": "保存", - "send": "Wegentに送信", - "undo": "元に戻す", - "redo": "やり直す" - }, - "hint": { - "copy_success": "クリップボードにコピーしました", - "save_success": "スクリーンショットを保存しました", - "send_title": "スクリーンショットを送信", - "permission_denied": "スクリーンショット権限が拒否されました。システム設定で画面録画を許可してください。" - } - } - } + "title": "環境設定" }, "tag": { "color_label": "タグの色", @@ -513,4 +517,4 @@ "name_label": "タグ名", "name_placeholder": "タグ名を入力してください" } -} \ No newline at end of file +} diff --git a/src/locales/zh-CN.json b/src/locales/zh-CN.json index 4c49fa2..f00ffa1 100644 --- a/src/locales/zh-CN.json +++ b/src/locales/zh-CN.json @@ -150,10 +150,10 @@ "open_source_address": "开源地址", "preference": "偏好设置", "relaunch": "重启应用", + "screenshot": "截图", "start_listening": "开启监听", "stop_listening": "停止监听", - "version": "版本", - "screenshot": "截图" + "version": "版本" } } }, @@ -173,6 +173,10 @@ "authorize": "去授权", "authorized": "已授权", "full_disk_access": { + "cancel": "取消", + "confirm": "前往系统设置", + "confirm_message": "完全磁盘访问权限需要在系统设置中手动开启。点击\"前往系统设置\"将打开系统偏好设置。", + "confirm_title": "需要完全磁盘访问权限", "description": "用于读取受保护路径下的文件内容", "title": "完全磁盘访问(Full Disk Access)" }, @@ -457,10 +461,10 @@ "general": "通用设置", "history": "历史记录", "privacy": "隐私声明", + "screenshot": "截图", "shortcut": "快捷键", "tag": "标签管理", - "wegent": "Wegent集成", - "screenshot": "截图" + "wegent": "Wegent集成" } }, "privacy": { @@ -483,6 +487,50 @@ "title": "隐私性考虑" } }, + "screenshot": { + "editor": { + "action": { + "cancel": "取消", + "copy": "复制", + "redo": "重做", + "save": "保存", + "send": "发送到 Wegent", + "undo": "撤销" + }, + "hint": { + "copy_success": "已复制到剪贴板", + "permission_denied": "截图权限被拒绝,请在系统设置中授权屏幕录制权限", + "save_success": "截图已保存", + "send_title": "发送截图" + }, + "tool": { + "arrow": "箭头", + "ellipse": "椭圆", + "mosaic": "马赛克", + "pen": "画笔", + "rect": "矩形", + "text": "文字" + } + }, + "settings": { + "default_action": { + "copy": "直接复制", + "menu": "弹出操作菜单", + "save": "直接保存" + }, + "hints": { + "default_action": "截图后的默认操作", + "save_format": "保存截图时的图片格式", + "save_to_history": "截图后自动将图片保存到剪贴板历史记录" + }, + "label": { + "default_action": "截图后默认行为", + "save_format": "保存格式", + "save_to_history": "自动保存到历史记录" + }, + "title": "截图设置" + } + }, "settings": { "app_settings": { "hints": { @@ -555,10 +603,10 @@ "copy_file_path": "激活窗口时,复制选中条目的文件路径到剪贴板", "paste_as_plain": "激活窗口时,将选中的内容粘贴为纯文本或路径", "quick_paste": "隐藏窗口时,使用数字组合键快速粘贴前九项", + "screenshot": "全局截图快捷键,按下后弹出截图界面", "send": "激活窗口时,将选中的内容发送到 AI 接口", "send_ai_chat": "激活窗口时,将选中的内容发送到 WegentChat", - "send_work_queue": "激活窗口时,将选中的内容发送到 Wegent待办", - "screenshot": "全局截图快捷键,按下后弹出截图界面" + "send_work_queue": "激活窗口时,将选中的内容发送到 Wegent待办" }, "label": { "copy_file_path": "复制文件路径", @@ -566,11 +614,11 @@ "open_settings": "打开偏好设置窗口", "paste_as_plain": "粘贴为纯文本", "quick_paste": "快速粘贴", + "screenshot": "截图", "send": "发送到 AI", "send_ai_chat": "发送到 WegentChat", "send_work_queue": "发送到 Wegent待办", - "wegent_group": "Wegent 发送", - "screenshot": "截图" + "wegent_group": "Wegent 发送" }, "title": "快捷键" } @@ -660,50 +708,6 @@ "normal": "普通" } } - }, - "screenshot": { - "settings": { - "title": "截图设置", - "label": { - "save_to_history": "自动保存到历史记录", - "default_action": "截图后默认行为", - "save_format": "保存格式" - }, - "hints": { - "save_to_history": "截图后自动将图片保存到剪贴板历史记录", - "default_action": "截图后的默认操作", - "save_format": "保存截图时的图片格式" - }, - "default_action": { - "menu": "弹出操作菜单", - "copy": "直接复制", - "save": "直接保存" - } - }, - "editor": { - "tool": { - "rect": "矩形", - "ellipse": "椭圆", - "arrow": "箭头", - "text": "文字", - "pen": "画笔", - "mosaic": "马赛克" - }, - "action": { - "cancel": "取消", - "copy": "复制", - "save": "保存", - "send": "发送到 Wegent", - "undo": "撤销", - "redo": "重做" - }, - "hint": { - "copy_success": "已复制到剪贴板", - "save_success": "截图已保存", - "send_title": "发送截图", - "permission_denied": "截图权限被拒绝,请在系统设置中授权屏幕录制权限" - } - } } }, "tag": { @@ -721,4 +725,4 @@ "name_label": "标签名称", "name_placeholder": "请输入标签名称" } -} \ No newline at end of file +} diff --git a/src/locales/zh-TW.json b/src/locales/zh-TW.json index 0231805..c9c45ea 100644 --- a/src/locales/zh-TW.json +++ b/src/locales/zh-TW.json @@ -93,10 +93,10 @@ "open_source_address": "開源地址", "preference": "偏好設定", "relaunch": "重啓應用", + "screenshot": "截圖", "start_listening": "開啟監聽", "stop_listening": "停止監聽", - "version": "版本", - "screenshot": "截圖" + "version": "版本" } } }, @@ -113,6 +113,10 @@ "authorize": "去授權", "authorized": "已授權", "full_disk_access": { + "cancel": "取消", + "confirm": "前往系統設定", + "confirm_message": "完整磁碟存取權限需要在系統設定中手動開啟。點擊「前往系統設定」將開啟系統偏好設定。", + "confirm_title": "需要完整磁碟存取權限", "description": "用於讀取受保護路徑下的檔案內容", "title": "完整磁碟存取(Full Disk Access)" }, @@ -341,8 +345,8 @@ "general": "通用設定", "history": "歷史記錄", "privacy": "隱私聲明", - "shortcut": "快捷鍵", - "screenshot": "截圖" + "screenshot": "截圖", + "shortcut": "快捷鍵" } }, "privacy": { @@ -365,6 +369,50 @@ "title": "隱私性考慮" } }, + "screenshot": { + "editor": { + "action": { + "cancel": "取消", + "copy": "複製", + "redo": "重做", + "save": "儲存", + "send": "傳送到 Wegent", + "undo": "復原" + }, + "hint": { + "copy_success": "已複製到剪貼簿", + "permission_denied": "截圖權限被拒絕,請在系統設定中授權螢幕錄製權限", + "save_success": "截圖已儲存", + "send_title": "傳送截圖" + }, + "tool": { + "arrow": "Arrow", + "ellipse": "Ellipse", + "mosaic": "Mosaic", + "pen": "Pen", + "rect": "Rectangle", + "text": "Text" + } + }, + "settings": { + "default_action": { + "copy": "直接複製", + "menu": "彈出操作選單", + "save": "直接儲存" + }, + "hints": { + "default_action": "截圖後的預設操作", + "save_format": "儲存截圖時的圖片格式", + "save_to_history": "截圖後自動將圖片儲存到剪貼簿歷史記錄" + }, + "label": { + "default_action": "截圖後預設行為", + "save_format": "儲存格式", + "save_to_history": "自動儲存到歷史記錄" + }, + "title": "截圖設定" + } + }, "settings": { "app_settings": { "hints": { @@ -437,8 +485,8 @@ "copy_file_path": "啟動視窗時,複製選中條目的檔案路徑到剪貼簿", "paste_as_plain": "啟動視窗時,將選中的內容粘貼為純文字或路徑", "quick_paste": "隱藏視窗時,使用數字鍵快速貼上前九項", - "send": "啟動視窗時,將選中的內容傳送到 AI 介面", - "screenshot": "全域截圖快捷鍵,按下後彈出截圖介面" + "screenshot": "全域截圖快捷鍵,按下後彈出截圖介面", + "send": "啟動視窗時,將選中的內容傳送到 AI 介面" }, "label": { "copy_file_path": "複製檔案路徑", @@ -446,57 +494,13 @@ "open_settings": "打開偏好設定視窗", "paste_as_plain": "貼上為純文字", "quick_paste": "快速貼上", - "send": "傳送到 AI", - "screenshot": "截圖" + "screenshot": "截圖", + "send": "傳送到 AI" }, "title": "快捷鍵" } }, - "title": "偏好設定", - "screenshot": { - "settings": { - "title": "截圖設定", - "label": { - "save_to_history": "自動儲存到歷史記錄", - "default_action": "截圖後預設行為", - "save_format": "儲存格式" - }, - "hints": { - "save_to_history": "截圖後自動將圖片儲存到剪貼簿歷史記錄", - "default_action": "截圖後的預設操作", - "save_format": "儲存截圖時的圖片格式" - }, - "default_action": { - "menu": "彈出操作選單", - "copy": "直接複製", - "save": "直接儲存" - } - }, - "editor": { - "tool": { - "rect": "Rectangle", - "ellipse": "Ellipse", - "arrow": "Arrow", - "text": "Text", - "pen": "Pen", - "mosaic": "Mosaic" - }, - "action": { - "cancel": "取消", - "copy": "複製", - "save": "儲存", - "send": "傳送到 Wegent", - "undo": "復原", - "redo": "重做" - }, - "hint": { - "copy_success": "已複製到剪貼簿", - "save_success": "截圖已儲存", - "send_title": "傳送截圖", - "permission_denied": "截圖權限被拒絕,請在系統設定中授權螢幕錄製權限" - } - } - } + "title": "偏好設定" }, "tag": { "color_label": "標籤顏色", @@ -513,4 +517,4 @@ "name_label": "標籤名稱", "name_placeholder": "請輸入標籤名稱" } -} \ No newline at end of file +} diff --git a/src/pages/Onboarding/index.tsx b/src/pages/Onboarding/index.tsx index f9498ad..f93b6eb 100644 --- a/src/pages/Onboarding/index.tsx +++ b/src/pages/Onboarding/index.tsx @@ -1,5 +1,6 @@ import { emit } from "@tauri-apps/api/event"; import { getCurrentWebviewWindow } from "@tauri-apps/api/webviewWindow"; +import { confirm } from "@tauri-apps/plugin-dialog"; import { useInterval } from "ahooks"; import { Button, Card, Flex, Tooltip, Typography } from "antd"; import { useEffect, useState } from "react"; @@ -53,16 +54,39 @@ const Onboarding = () => { setFullDiskAccessGranted(fullDisk); }; + // 请求辅助功能权限 const handleRequestAccessibility = async () => { await requestAccessibilityPermission(); + // 立即检查一次,然后开始轮询 + const granted = await checkAccessibilityPermission(); + setAccessibilityGranted(granted); }; + // 请求屏幕录制权限 const handleRequestScreenRecording = async () => { await requestScreenRecordingPermission(); + // 立即检查一次,然后开始轮询 + const granted = await checkScreenRecordingPermission(); + setScreenRecordingGranted(granted); }; + // 请求完全磁盘访问权限(需要确认对话框) const handleRequestFullDiskAccess = async () => { + const confirmed = await confirm( + t("onboarding.permission.full_disk_access.confirm_message"), + { + cancelLabel: t("onboarding.permission.full_disk_access.cancel"), + okLabel: t("onboarding.permission.full_disk_access.confirm"), + title: t("onboarding.permission.full_disk_access.confirm_title"), + }, + ); + + if (!confirmed) return; + await requestFullDiskAccessPermission(); + // 立即检查一次 + const granted = await checkFullDiskAccessPermission(); + setFullDiskAccessGranted(granted); }; const handleComplete = async () => { diff --git a/src/stores/global.ts b/src/stores/global.ts index 5dc55de..b1ce977 100644 --- a/src/stores/global.ts +++ b/src/stores/global.ts @@ -5,10 +5,10 @@ import { isMac } from "@/utils/is"; export const globalStore = proxy({ app: { autoStart: false, + hasCompletedOnboarding: false, showMenubarIcon: true, showTaskbarIcon: false, silentStart: false, - hasCompletedOnboarding: false, }, appearance: { @@ -22,7 +22,7 @@ export const globalStore = proxy({ defaultAction: "menu", saveFormat: "png", saveToHistory: true, - shortcut: isMac ? "Command+Control+KeyA" : "Control+Alt+KeyA", + shortcut: isMac ? "Command+Control+A" : "Control+Alt+A", }, shortcut: { @@ -34,7 +34,7 @@ export const globalStore = proxy({ enable: false, value: "Command+Shift", }, - screenshot: isMac ? "Command+Control+KeyA" : "Control+Alt+KeyA", + screenshot: isMac ? "Command+Control+A" : "Control+Alt+A", // 兼容旧配置 send: "", wegent: {