From ef592e426799cd46ab9a90d838f2509d42a224f4 Mon Sep 17 00:00:00 2001
From: sugood <15820258199@163.com>
Date: Sun, 9 Jan 2022 13:14:59 +0800
Subject: [PATCH 1/2] =?UTF-8?q?v0.1.3=201=E3=80=81=E5=B1=8F=E5=B9=95?=
=?UTF-8?q?=E5=8F=96=E8=89=B2=E8=AE=BE=E7=BD=AE=E5=BF=AB=E6=8D=B7=E9=94=AE?=
=?UTF-8?q?alt+cmd+p=202=E3=80=81=E5=92=96=E5=95=A1=E5=9B=A0=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E5=BF=AB=E6=8D=B7=E9=94=AEalt+cmd+c=203=E3=80=81json?=
=?UTF-8?q?=20=E8=A7=A3=E6=9E=90=E7=95=8C=E9=9D=A2=E4=BF=AE=E6=94=B9?=
=?UTF-8?q?=EF=BC=8C=E8=A7=A6=E5=8F=91=E5=BF=AB=E6=8D=B7=E9=94=AE=E5=90=8C?=
=?UTF-8?q?=E6=97=B6=E5=A4=8D=E5=88=B6=E9=80=89=E4=B8=AD=E7=9A=84=E6=96=87?=
=?UTF-8?q?=E6=9C=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 3 +-
.idea/.hammerspoon.iml | 9 -
.idea/modules.xml | 8 -
.idea/vcs.xml | 6 -
.idea/workspace.xml | 860 -----------------------------------------
README.md | 4 +
README_en.md | 4 +
data/history.json | 24 ++
init.lua | 2 +-
modules/commons.lua | 36 +-
modules/jsonFormat.lua | 159 +-------
11 files changed, 69 insertions(+), 1046 deletions(-)
delete mode 100644 .idea/.hammerspoon.iml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/vcs.xml
delete mode 100644 .idea/workspace.xml
diff --git a/.gitignore b/.gitignore
index 48dc859..bf2d64c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
/.idea/
-/*.zip
\ No newline at end of file
+/*.zip
+.idea/
\ No newline at end of file
diff --git a/.idea/.hammerspoon.iml b/.idea/.hammerspoon.iml
deleted file mode 100644
index d6ebd48..0000000
--- a/.idea/.hammerspoon.iml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index e632461..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 03b4004..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,860 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- console.clearConsole()
- menubar
- config
- menubar.new(true)
- searchResult
- keywords
- hs.hotkey.bind
- hs.hotkey
- displayIdle
- syntaxHighlight
- hs.alert.show
- 切换
- isSyncTime
- hs.dialog
- else if
- elseif
- colorDialog
- appid
- mChooser
- baiduAppSecret
- baiduAppid
- hs.dialog.blockAlert
- ydAppKey
- hyperCmd
- stringIsEmpty
- listenerEvent
- config.json
- greyby
- destinationfile
- sourcefile
-
-
- self.menubar
- macMenubar
- sugood
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 8a54b63..8d0122d 100644
--- a/README.md
+++ b/README.md
@@ -101,10 +101,14 @@ https://github.com/greyby/hammerspoon
### 屏幕取色功能
+* ⌥⌘ + P 颜色拾取器
+
菜单栏点击屏幕取色,出现取色界面后点击颜色拾取器,就可以获取当前屏幕鼠标所在位置的颜色值
### 咖啡因
+* ⌥⌘ + C 咖啡因
+
菜单栏点击 咖啡因打开系统永不休眠功能,再点击一次就能关闭
### 状态栏显示输入法状态
diff --git a/README_en.md b/README_en.md
index ded2e9f..7ce1b07 100644
--- a/README_en.md
+++ b/README_en.md
@@ -100,10 +100,14 @@ Support baidu and youdao translation API. Baidu Translation can be used directly
### Screen color selection function
+* ⌥⌘ + P 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
+* ⌥⌘ + C 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
diff --git a/data/history.json b/data/history.json
index 0ffe9e4..c3b1157 100644
--- a/data/history.json
+++ b/data/history.json
@@ -47,6 +47,10 @@
"subText" : "cmd|diff file1 file2|比较并显示两个文件的差异",
"text" : "diff"
},
+ {
+ "subText" : "cmd|journalctl -f -u xx.service -n1000|显示日志",
+ "text" : "journalctl -f -u xx.service -n1000"
+ },
{
"subText" : "cmd|kill -9 pid|终止进程",
"text" : "kill"
@@ -147,6 +151,26 @@
"subText" : "code|java|author注释模板",
"text" : "\/** \n* @Title: ${file_name} \n* @Package ${package_name} \n* @Description: ${todo}(用一句话描述该文件做什么) \n* @author sugood\n* @date ${date} ${time} \n* @version V1.0 \n*\/"
},
+ {
+ "subText" : "flutter build apk --release",
+ "text" : "flutter build apk --release"
+ },
+ {
+ "subText" : "flutter build ios --release",
+ "text" : "flutter build ios --release"
+ },
+ {
+ "subText" : "flutter clean",
+ "text" : "flutter clean"
+ },
+ {
+ "subText" : "flutter doctor",
+ "text" : "flutter doctor"
+ },
+ {
+ "subText" : "flutter run --debug",
+ "text" : "flutter run --debug"
+ },
{
"subText" : "ins|brew install node|安装node",
"text" : "brew install node"
diff --git a/init.lua b/init.lua
index 68e7a4b..466028b 100644
--- a/init.lua
+++ b/init.lua
@@ -2,8 +2,8 @@ hs.configdir = os.getenv('HOME') .. '/.hammerspoon'
package.path = hs.configdir .. '/?.lua;' .. hs.configdir .. '/?/init.lua;' .. hs.configdir .. '/Spoons/?.spoon/init.lua;' .. package.path
require "modules/reload"
-require "modules/commons"
require "modules/hotkey"
+require "modules/commons"
require "modules/system"
require "modules/windows"
require "modules/launcher"
diff --git a/modules/commons.lua b/modules/commons.lua
index 5df8408..1ae8c7c 100644
--- a/modules/commons.lua
+++ b/modules/commons.lua
@@ -4,7 +4,7 @@
--- DateTime: 2020/10/24 14:13
---
local console = require("hs.console")
-version = "v0.1.2"
+version = "v0.1.3"
configPath= "~/.hammerspoon/data/config.json"
initConfigPath= "~/.hammerspoon/data/initConfig.json"
config = {}
@@ -124,15 +124,7 @@ function initMenu()
end },
{ title = "-" },
{ title = "屏幕取色", fn = function()
- hs.openConsole(true)
- colorDialog.show()
- colorDialog.mode("RGB")
- colorDialog.callback(function(a,b)
- if b then
- hs.closeConsole()
- end
- end)
- hs.closeConsole()
+ openColorDialog()
end },
{ title = "-" },
{ title = "咖啡因:" .. config[1].caffeine, fn = function()
@@ -259,4 +251,26 @@ function isCopySuccess()
local numAfter = hs.pasteboard.changeCount()
print("复制后数量:"..numAfter)
return numAfter > num
-end
\ No newline at end of file
+end
+
+function openColorDialog()
+ hs.openConsole(true)
+ colorDialog.show()
+ colorDialog.mode("RGB")
+ colorDialog.callback(function(a,b)
+ if b then
+ hs.closeConsole()
+ end
+ end)
+ hs.closeConsole()
+end
+
+--设置颜色拾取快键键
+hs.hotkey.bind(hyperCmd, "P", function ()
+ openColorDialog()
+end)
+
+--设置颜色拾取快键键
+hs.hotkey.bind(hyperCmd, "C", function ()
+ switchCaffeine()
+end)
\ No newline at end of file
diff --git a/modules/jsonFormat.lua b/modules/jsonFormat.lua
index 4cb3290..c007bb1 100644
--- a/modules/jsonFormat.lua
+++ b/modules/jsonFormat.lua
@@ -6,154 +6,6 @@
--
--
-local function generateHtml()
-
- local html = [[
-
-
-
-
-Json格式化高亮展示工具
-
-
-
-
-
-
Json格式化高亮展示工具
-
-
-
-
-
-
-
-
-
- ]]
-
- return html
-end
-
-
--- KSheet:hide()
--- Method
--- Hide the cheatsheet view.
@@ -187,8 +39,11 @@ end
--- Method
--- Show current application's keybindings in a view.
function show(time)
- local webcontent = generateHtml()
- sheetView:html(webcontent, "http://localhost")
+ bindCopyKey()
+ local str = hs.pasteboard.getContents()
+ -- local webcontent = generateHtml()
+ -- sheetView:html(webcontent, "http://localhost")
+ sheetView:url("https://i.sugood.xyz/pages/jsonweb.html")
sheetView:show(time)
end
@@ -202,6 +57,10 @@ end
init()
+-- 按下添加快捷键时映射到复制快捷键
+function bindCopyKey()
+ hs.eventtap.keyStroke({ "cmd" }, "C")
+end
-- 添加片段(按下快捷键时做一个复制操作,并记录复制的内容到片段列表中)
hs.hotkey.bind(hyperCmd, "G", function ()
toggle()
From 5fb1619ebca6be11b0357b1b1d621d27402a4a60 Mon Sep 17 00:00:00 2001
From: sugood <15820258199@163.com>
Date: Sun, 9 Jan 2022 13:24:24 +0800
Subject: [PATCH 2/2] =?UTF-8?q?v0.1.3=20=E8=A1=A5=E5=85=85?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/README.md b/README.md
index 8d0122d..2412bcc 100644
--- a/README.md
+++ b/README.md
@@ -87,6 +87,8 @@ https://github.com/greyby/hammerspoon
* ⌥⌘ + G JSON格式化
+自动复制选中的文本
+
### 自动同步时间
* ⌥⌘ + T 自动同步时间