瀏覽代碼

Merge pull request #703 from ClDaniel1/taskbar-icon-shortcut

任务栏小窗开关
oldj 3 年之前
父節點
當前提交
d326838f16

+ 1 - 0
src/common/default_configs.ts

@@ -29,6 +29,7 @@ const configs = {
   proxy_port: 0,
   http_api_on: false,
   http_api_only_local: true,
+  tray_mini_window: true,
 
   // other
   env: 'PROD' as 'PROD' | 'DEV',

+ 1 - 0
src/common/i18n/languages/de.ts

@@ -76,6 +76,7 @@
     http_api_on_desc:
       'Läuft auf Port {0}, kann von Software von Drittanbietern wie Alfred verwendet werden, um den Host zu wechseln.',
     http_api_only_local: 'HTTP-API hört nur auf 127.0.0.1',
+    tray_mini_window: 'Taskleistensymbol-Verknüpfung',
     ignore_case: 'Groß- und Kleinschreibung ignorieren',
     import: 'Importieren',
     import_done: 'Der Import ist abgeschlossen.',

+ 1 - 0
src/common/i18n/languages/en.ts

@@ -76,6 +76,7 @@ export default {
   http_api_on_desc:
     'Runs on port {0}, can be used by third-party software such as Alfred to switch hosts.',
   http_api_only_local: 'HTTP API only listen 127.0.0.1',
+  tray_mini_window: 'taskbar icon shortcut',
   ignore_case: 'Ignore case',
   import: 'Import',
   import_done: 'The import is complete.',

+ 1 - 0
src/common/i18n/languages/fr.ts

@@ -76,6 +76,7 @@ export default {
   http_api_on_desc:
     "Actif sur le port {0}, peut être utilisé par un logiciel tier comme Alfred pour changer d'hosts",
   http_api_only_local: "L'API HTTP n'écoute que sur 127.0.0.1",
+  tray_mini_window: 'raccourci de l\'icône de la barre des tâches',
   ignore_case: 'Ignorer la casse',
   import: 'Importer',
   import_done: "L'importation est terminée",

+ 1 - 0
src/common/i18n/languages/zh.ts

@@ -75,6 +75,7 @@ const lang: LanguageDict = {
   http_api_on: '开启 HTTP API',
   http_api_on_desc: '运行于 {0} 端口,可用于 Alfred 等第三方软件切换 hosts。',
   http_api_only_local: 'HTTP API 仅监听 127.0.0.1',
+  tray_mini_window: '任务栏快捷小窗',
   ignore_case: '忽略大小写',
   import: '导入',
   import_done: '导入已完成。',

+ 4 - 1
src/main/ui/tray/index.ts

@@ -75,7 +75,10 @@ const makeTray = async () => {
     return
   }
 
-  tray.on('click', () => window())
+  tray.on('click', async () => {
+    let tray_mini_window = await configGet('tray_mini_window')
+    tray_mini_window ? window() : broadcast(events.active_main_window)
+  })
 
   tray.on('double-click', () => broadcast(events.active_main_window))
 

+ 13 - 0
src/renderer/components/Pref/General.tsx

@@ -183,6 +183,19 @@ const General = (props: IProps) => {
         </VStack>
       </FormControl>
 
+      <FormControl>
+        <VStack align="left">
+          <Checkbox
+              isChecked={data.tray_mini_window}
+              onChange={(e) =>
+                  onChange({ tray_mini_window: e.target.checked })
+              }
+          >
+            {lang.tray_mini_window}
+          </Checkbox>
+        </VStack>
+      </FormControl>
+
       <FormControl>
         <VStack align="left">
           <Checkbox