1. 右键对译文或者原文进行朗读
2. 修改说明文件
This commit is contained in:
sugood 2022-04-10 21:55:53 +08:00
parent af7df6d3f5
commit 4e885b3869
3 changed files with 97 additions and 47 deletions

View File

@ -24,6 +24,7 @@
<!-- more -->
# 此脚本的优势
本脚本相当于整合了多个APP的功能。对比如下
@ -33,7 +34,7 @@
- 对比各种JSON格式化网页本工具能通过快键键便捷打开界面而且不用拉起任何浏览器。
- 与各种翻译APP对比本工具的功能更加纯粹而且通过快捷键能快速的进行翻译
- 与各种翻译APP对比本工具的功能更加纯粹而且通过快捷键能快速的进行翻译,右键对译文或者原文进行朗读
- 对比通过系统电池设置屏幕常亮需要麻烦的操作,本工具的咖啡因功能,可以一键切换屏幕常亮和普通模式
@ -125,6 +126,10 @@ git pull origin master
### 翻译
* <kbd></kbd><kbd></kbd> + <kbd>F</kbd> 翻译
1. 功能说明
- 默认使用百度翻译可设置自己的百度或有道API进行翻译
- 使用MacOS TTS功能对译文或者原文进行朗读
#### 界面与功能说明
界面
@ -143,6 +148,7 @@ git pull origin master
- 可保存数据到本地,下次打开还能显示上次的结果
- 如果翻译的文字很长。可以点击右键查看详情或者是进入网页查看详情
### 屏幕取色功能
* <kbd></kbd><kbd></kbd> + <kbd>P</kbd> 打开取色器
1. 界面如下
![paste image](http://imgs.sugood.xyz/1642389183172fq3h28sb.png?imageslim)
@ -151,6 +157,9 @@ git pull origin master
菜单栏点击屏幕取色,出现取色界面后点击颜色拾取器,就可以获取当前屏幕鼠标所在位置的颜色值
### 咖啡因
* <kbd></kbd><kbd></kbd> + <kbd>S</kbd> 咖啡因开关
1. 界面如下
![paste image](http://imgs.sugood.xyz/1642389211527sub01we5.png?imageslim)
@ -227,7 +236,3 @@ git pull origin master
* <kbd></kbd><kbd></kbd> + <kbd>T</kbd> `Terminal`
* <kbd></kbd><kbd></kbd> + <kbd>S</kbd> `System Preferences`
* <kbd></kbd><kbd></kbd> + <kbd>Z</kbd> `Calculator`
# 总结
状态栏的图标终于不是满满的了。开心:-)

View File

@ -22,7 +22,72 @@ https://github.com/greyby/hammerspoon
- en [English](README_en.md)
- zh_CN [简体中文](README.md)
## Features
# SOFTWARE ENVIRONMENT
systemsMacOS 10.14 +
# Script Function description
The following functions have been performed
1. The status bar displays the status of the input method
2. Time synchronization
3. Screen color selection function
4. JSON formatting tools
5. Translation function (baidu and Youdao API support)
6. Caffeine (Set system to never sleep)
7. memo
8. Status bar displays system information (CPU/ memory/hard disk/Network speed)
9. Window management
10. Shortcut keys to quickly launch other applications
# Features
### JSON Formatting
* <kbd></kbd><kbd></kbd> + <kbd>G</kbd> JSON Formatting
#### Interface and function description
1. interface
![paste image](http://imgs.sugood.xyz/1642388815070fcmlt9bk.png?imageslim)
2. Introduction
- THE JSON formatting
- JSON code highlights
- Can search
- JSON to XML
- JSON to CSV
- JSON to YAML
### Snippet & Memorandum
* <kbd></kbd><kbd></kbd> + <kbd>X</kbd> Add a snippet or memos
* <kbd></kbd><kbd></kbd> + <kbd>V</kbd> List snippet or memos and use them
### automatic synchronization time
* <kbd></kbd><kbd></kbd> + <kbd>T</kbd> automatic synchronization time
### Translation
* <kbd></kbd><kbd></kbd> + <kbd>F</kbd> Translation
Support baidu and youdao translation API. Baidu Translation can be used directly. Youdao translation requires first applying youdao translation API and configuring appKey and appSecret
### Screen color selection function
* <kbd></kbd><kbd></kbd> + <kbd>P</kbd> Screen color selection function
Click the screen color in the menu bar, click the color picker after the screen color picker interface appears, and the color value at the position of the mouse on the screen can be obtained
### caffeine
* <kbd></kbd><kbd></kbd> + <kbd>S</kbd> caffeine
On the menu bar, click caffeine to turn on the system's never sleep feature, and then click again to turn it off
### The status bar shows the status of the input method
Can display case status, input method status, Chinese and English status. So far, only sogou input method has been tested
### Window Management
@ -71,45 +136,12 @@ https://github.com/greyby/hammerspoon
### Launch Application
* <kbd></kbd><kbd></kbd> + <kbd>I</kbd> `IntelliJ IDEA`
* <kbd></kbd><kbd></kbd> + <kbd>T</kbd> `Terminal`
* <kbd></kbd><kbd></kbd> + <kbd>Z</kbd> `Calculator`
* <kbd></kbd><kbd></kbd> + <kbd>D</kbd> `Finder`
* <kbd></kbd><kbd></kbd> + <kbd>Q</kbd> `Activity Monitor`
* <kbd></kbd><kbd></kbd> + <kbd>S</kbd> `System Preferences`
* <kbd></kbd><kbd></kbd> + <kbd>C</kbd> `Google Chrome`
* <kbd></kbd><kbd></kbd> + <kbd>A</kbd> `Launchpad`
### Snippet & Memorandum
* <kbd></kbd><kbd></kbd> + <kbd>X</kbd> Add a snippet or memos
* <kbd></kbd><kbd></kbd> + <kbd>V</kbd> List snippet or memos and use them
### JSON format
* <kbd></kbd><kbd></kbd> + <kbd>G</kbd> JSON format
### automatic synchronization time
* <kbd></kbd><kbd></kbd> + <kbd>T</kbd> automatic synchronization time
### Translation
* <kbd></kbd><kbd></kbd> + <kbd>F</kbd> Translation
Support baidu and youdao translation API. Baidu Translation can be used directly. Youdao translation requires first applying youdao translation API and configuring appKey and appSecret
### Screen color selection function
* <kbd></kbd><kbd></kbd> + <kbd>P</kbd> Screen color selection function
Click the screen color in the menu bar, click the color picker after the screen color picker interface appears, and the color value at the position of the mouse on the screen can be obtained
### caffeine
* <kbd></kbd><kbd></kbd> + <kbd>C</kbd> caffeine
On the menu bar, click caffeine to turn on the system's never sleep feature, and then click again to turn it off
### The status bar shows the status of the input method
Can display case status, input method status, Chinese and English status. So far, only sogou input method has been tested
* <kbd></kbd><kbd></kbd> + <kbd>C</kbd> `calendar`
* <kbd></kbd><kbd></kbd> + <kbd>D</kbd> `Disk Utility`
* <kbd></kbd><kbd></kbd> + <kbd>E</kbd> `Finder`
* <kbd></kbd><kbd></kbd> + <kbd>G</kbd> `Google Chrome`
* <kbd></kbd><kbd></kbd> + <kbd>Q</kbd> `Activity Monitor`
* <kbd></kbd><kbd></kbd> + <kbd>T</kbd> `Terminal`
* <kbd></kbd><kbd></kbd> + <kbd>S</kbd> `System Preferences`
* <kbd></kbd><kbd></kbd> + <kbd>Z</kbd> `Calculator`

View File

@ -67,11 +67,24 @@ local rightClickCallbackFn = function(index)
{ title = "查看网页", fn = function()
sheetView:url(selectResult.webUrl):show()
end },
{ title = "-" },
{ title = "朗读译文", fn = function()
speak(selectResult.text)
end },
{ title = "朗读原文", fn = function()
speak(selectResult.subText)
end },
})
menubar:popupMenu(hs.mouse.getAbsolutePosition(), true)
end
end
-- 系统发音
function speak(str)
speaker = hs.speech.new()
speaker:speak(str)
end
function getBaiduApi(q)
headers = {ContentType = "application/x-www-form-urlencoded;charset=utf-8"}
salt = tostring(hs.timer.secondsSinceEpoch()*1000)