1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-24 21:43:21 +08:00
parent 7bdc1bc380
commit 2d1c99af56
2 changed files with 7 additions and 1 deletions

View File

@ -185,3 +185,6 @@ end tell
`, strings.Join(arg, "; ")))
return m
}
func OSAScript(m *ice.Message, arg ...string) {
m.Cmd(SYSTEM, "osascript", "-e", arg)
}

View File

@ -163,7 +163,7 @@ const RUNTIME = "runtime"
func init() {
Index.MergeCommands(ice.Commands{
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto upgrade restart reboot logs conf", Icon: "Infomation.png", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto upgrade restart reboot logs conf lock", Icon: "Infomation.png", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
aaa.White(m, ice.LICENSE)
_runtime_init(m)
@ -269,6 +269,9 @@ func init() {
"conf": {Help: "配置", Hand: func(m *ice.Message, arg ...string) {
OpenCmds(m, kit.Format("cd %s", kit.Path("")), "vim etc/init.shy")
}},
"lock": {Help: "锁屏", Hand: func(m *ice.Message, arg ...string) {
OSAScript(m, `tell application "System Events" to keystroke "q" using {control down, command down}`)
}},
}, ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
kit.If(len(arg) > 0 && arg[0] == BOOTINFO, func() { arg = arg[1:] })
m.Cmdy(ctx.CONFIG, RUNTIME, arg).StatusTime(mdb.TIME, ice.Info.Make.Time,