v0.1.3 补充
1、通过快捷键打开颜色取色器 2、通过快捷键打开咖啡因 3、json 解析器工具修改为菜鸟工具的解析器 4、优化一些BUG
This commit is contained in:
parent
53ee0e4030
commit
061b86795c
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/.idea/
|
||||
/*.zip
|
||||
/*.zip
|
||||
.idea
|
@ -120,7 +120,7 @@
|
||||
"text" : "source ~\/.bash_profile"
|
||||
},
|
||||
{
|
||||
"subText" : "cmd|ssh username@ip|ssh远程登录",
|
||||
"subText" : "cmd|ssh -p username@ip|ssh远程登录",
|
||||
"text" : "ssh"
|
||||
},
|
||||
{
|
||||
@ -147,10 +147,30 @@
|
||||
"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 --no-shrink",
|
||||
"text" : "flutter build apk --no-shrink"
|
||||
},
|
||||
{
|
||||
"subText" : "flutter clean",
|
||||
"text" : "flutter clean"
|
||||
},
|
||||
{
|
||||
"subText" : "flutter packages pub run build_runner build --delete-conflicting-outputs",
|
||||
"text" : "flutter packages pub run build_runner build --delete-conflicting-outputs"
|
||||
},
|
||||
{
|
||||
"subText" : "ins|brew install node|安装node",
|
||||
"text" : "brew install node"
|
||||
},
|
||||
{
|
||||
"subText" : "keytool -genkey -v -keystore myKey.jks -keyalg RSA -keysize 2048 -validity 36500 -alias myAlias",
|
||||
"text" : "keytool -genkey -v -keystore myKey.jks -keyalg RSA -keysize 2048 -validity 36500 -alias myAlias"
|
||||
},
|
||||
{
|
||||
"subText" : "keytool|keytool -list -v -keystore xx.jks|生成kjs",
|
||||
"text" : "keytool -list -v -keystore"
|
||||
},
|
||||
{
|
||||
"subText" : "key|Command+Option+C|复制路径",
|
||||
"text" : "Command+Option+C"
|
||||
@ -162,5 +182,25 @@
|
||||
{
|
||||
"subText" : "key|Command+Shift+.|显示隐藏文件",
|
||||
"text" : "Command+Shift+."
|
||||
},
|
||||
{
|
||||
"subText" : "md | link",
|
||||
"text" : "[超链接显示名](超链接地址 \"超链接title\")"
|
||||
},
|
||||
{
|
||||
"subText" : "md | more ",
|
||||
"text" : "<!-- more -->"
|
||||
},
|
||||
{
|
||||
"subText" : "md | system info",
|
||||
"text" : "- System version: MacOS 12\n- Flutter version: 1.22.5\n- Dart version: 2.10.4\n- Android Studio version: 4.1.1"
|
||||
},
|
||||
{
|
||||
"subText" : "sudo smartctl -H \/dev\/sda | 硬盘是否健康",
|
||||
"text" : "sudo smartctl -H \/dev\/sda"
|
||||
},
|
||||
{
|
||||
"subText" : "sudo smartctl -i \/dev\/sda | 硬盘是否支持健康检查",
|
||||
"text" : "sudo smartctl -i \/dev\/sda"
|
||||
}
|
||||
]
|
2
init.lua
2
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"
|
||||
|
@ -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()
|
||||
openColorDilog()
|
||||
end },
|
||||
{ title = "-" },
|
||||
{ title = "咖啡因:" .. config[1].caffeine, fn = function()
|
||||
@ -170,7 +162,7 @@ function initData()
|
||||
initMenu()
|
||||
-- 修改全局alert样式
|
||||
hs.alert.defaultStyle.strokeColor = {white = 1, alpha = 0}
|
||||
hs.alert.defaultStyle.fillColor = {white = 0.05, alpha = 0.75}
|
||||
hs.alert.defaultStyle.fillColor = {white = 0.05, alpha = 0.50}
|
||||
hs.alert.defaultStyle.radius = 10
|
||||
--清空打印信息
|
||||
console.clearConsole()
|
||||
@ -259,4 +251,28 @@ function isCopySuccess()
|
||||
local numAfter = hs.pasteboard.changeCount()
|
||||
print("复制后数量:"..numAfter)
|
||||
return numAfter > num
|
||||
end
|
||||
end
|
||||
|
||||
--打开取色器
|
||||
function openColorDilog()
|
||||
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 ()
|
||||
openColorDilog()
|
||||
end)
|
||||
|
||||
--设置咖啡因快捷键
|
||||
hs.hotkey.bind(hyperCmd, "C", function ()
|
||||
switchCaffeine()
|
||||
end)
|
@ -71,7 +71,7 @@ function initData()
|
||||
else
|
||||
hs.hid.led.set('caps',false)
|
||||
hs.alert.closeAll(0)
|
||||
hs.alert.show("键盘小写 🔤- OFF")
|
||||
hs.alert.show("键盘小写 🔤- OFF", 0.5)
|
||||
if(isChinese()) then
|
||||
if(reverse) then
|
||||
macMenubar:setIcon(imgInputCn)
|
||||
@ -86,7 +86,7 @@ function initData()
|
||||
if hs.hid.capslock.get() then
|
||||
hs.hid.led.set('caps',true)
|
||||
hs.alert.closeAll(0)
|
||||
hs.alert.show("键盘大写 🅰️- ON")
|
||||
hs.alert.show("键盘大写 🅰️- ON", 0.5)
|
||||
macMenubar:setIcon(imgInputU)
|
||||
else
|
||||
--print("小写2")
|
||||
|
@ -18,12 +18,16 @@ local function generateHtml()
|
||||
<style>
|
||||
body { height: 100%; margin:0; font-family:"微软雅黑"; font-size:12px; }
|
||||
.pdiv { height: 85%; position: absolute; }
|
||||
.title { height: auto; font-size:20px; text-align:center; margin-top: 5px; margin-bottom: 20px;}
|
||||
.title { height: auto; font-size:20px; text-align:center; margin-top: 5px; margin-bottom: 20px; position:fixed; top:0;}
|
||||
.author { height: auto; width: 100%; font-size:12px; text-align:center; margin-top: 30px; margin-bottom: 20px;}
|
||||
table { height: 100%; width:100%; border-collapse:collapse; }
|
||||
table .tdLeft { width:85%; text-align:left; padding-left: 10px;padding-right: 10px;}
|
||||
table .tdmid { width:150px; text-align:center; margin: 0px; padding: 0px;}
|
||||
table .tdRight { width:85%; padding-right: 30px;text-align:left; }
|
||||
.tableContext{ height: 100%; width:100%; border-collapse:collapse; margin-top: 60px}
|
||||
.tableTop { height: 20px; width:100%; border-collapse:collapse;}
|
||||
table .tdLeft { width:30%; text-align:left; padding-left: 10px;padding-right: 10px; ;}
|
||||
table .tdmid { width:10px; text-align:center; margin: 0px; padding: 0px; margin-top: 100px;}
|
||||
table .tdRight { width:85%; padding-right: 30px;text-align:left; margin-top: 100px;}
|
||||
table .tdTopLeft { width:20%; height:10%; text-align:left; padding-left: 10px;padding-right: 10px;}
|
||||
table .tdTopMid { width:200px; height:10%; text-align:center; margin: 0px; padding: 0px;}
|
||||
table .tdTopRight { width:85%; height:10%; padding-right: 30px;text-align:right; }
|
||||
table textarea { width:100%; height:100%; font-size:14px; padding-top: 10px; padding-left: 10px; outline: none; border-radius: 15px; border: 2px solid #8AC007; }
|
||||
#container { width:100%; height:100%; font-size:14px; padding-top: 10px; padding-left: 10px; border-radius: 15px; border: 2px solid #8AC007;}
|
||||
pre{white-space:pre-wrap; white-space:-moz-pre-wrap; white-space:-o-pre-wrap; word-wrap:break-word; margin: 0px; padding: 5px;}
|
||||
@ -36,17 +40,29 @@ local function generateHtml()
|
||||
</head>
|
||||
<body>
|
||||
<div class="pdiv">
|
||||
<div class="title" >Json格式化高亮展示工具</div>
|
||||
<table style="table-layout:fixed">
|
||||
<div class="title" >
|
||||
Json格式化高亮展示工具
|
||||
<table class="tableTop">
|
||||
<tr>
|
||||
<td class="tdTopLeft">
|
||||
<input style="width:auto; margin: 10px;" type="button" value="复制" onClick="copySource()">
|
||||
</td>
|
||||
<td class="tdTopMid" valign="top"><input style="width:100%;" type="button" value="格式化JSON >>" onClick="showJson()"></td>
|
||||
<td class="tdTopRight">
|
||||
<input style="width:auto; margin: 10px;" type="button" value="复制" onClick="copyResult()">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<table class="tableContext" style="table-layout:fixed">
|
||||
<tr>
|
||||
<!-- <td class="tdLeft" nowrap>请输入要展示的Json:</td> -->
|
||||
<td class="tdLeft">
|
||||
<input style="width:auto; margin: 10px;" type="button" value="复制" onClick="copySource()">
|
||||
<textarea name = "jsonContent" id="jsonContent" ></textarea>
|
||||
</td>
|
||||
<td class="tdmid"><input style="width:80%;" type="button" value="格式化JSON >>" onClick="showJson()"></td>
|
||||
<td class="tdmid" valign="top"></td>
|
||||
<td class="tdRight">
|
||||
<input style="width:auto; margin: 10px;" type="button" value="复制" onClick="copyResult()">
|
||||
<pre id="container"></pre>
|
||||
</td>
|
||||
</tr>
|
||||
@ -174,12 +190,14 @@ function init()
|
||||
sheetView:windowStyle("utility")
|
||||
sheetView:titleVisibility("hidden")
|
||||
sheetView:allowGestures(true)
|
||||
sheetView:allowNewWindows(false)
|
||||
sheetView:allowNewWindows(true)
|
||||
sheetView:allowTextEntry(true)
|
||||
sheetView:closeOnEscape(true)
|
||||
sheetView:bringToFront(false)
|
||||
sheetView:darkMode(true)
|
||||
sheetView:reload(false)
|
||||
sheetView:shadow(true)
|
||||
sheetView:alpha(1)
|
||||
sheetView:level(hs.drawing.windowLevels.mainMenu)
|
||||
end
|
||||
|
||||
@ -188,15 +206,17 @@ end
|
||||
--- Show current application's keybindings in a view.
|
||||
function show(time)
|
||||
local webcontent = generateHtml()
|
||||
sheetView:html(webcontent, "http://localhost")
|
||||
-- sheetView:html(webcontent, "http://localhost")
|
||||
-- sheetView:url("https://www.jsonin.com/")
|
||||
sheetView:url("https://c.runoob.com/front-end/53/")
|
||||
sheetView:show(time)
|
||||
end
|
||||
|
||||
function toggle()
|
||||
if sheetView and sheetView:hswindow() and sheetView:hswindow():isVisible() then
|
||||
hide(2)
|
||||
hide(1)
|
||||
else
|
||||
show(2)
|
||||
show(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user