forked from x/icebergs
62 lines
2.4 KiB
Go
62 lines
2.4 KiB
Go
package macos
|
|
|
|
import (
|
|
ice "shylinux.com/x/icebergs"
|
|
"shylinux.com/x/icebergs/base/cli"
|
|
"shylinux.com/x/icebergs/base/ctx"
|
|
"shylinux.com/x/icebergs/base/mdb"
|
|
"shylinux.com/x/icebergs/base/nfs"
|
|
"shylinux.com/x/icebergs/base/web"
|
|
"shylinux.com/x/icebergs/core/code"
|
|
"shylinux.com/x/icebergs/core/team"
|
|
kit "shylinux.com/x/toolkits"
|
|
)
|
|
|
|
const APPLICATIONS = "applications"
|
|
|
|
func init() {
|
|
Index.MergeCommands(ice.Commands{
|
|
APPLICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
|
Notify(m, cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
|
FinderAppend(m, "Applications", m.PrefixKey())
|
|
AppInstall(m, "Finder", nfs.DIR)
|
|
AppInstall(m, "Safari", web.CHAT_IFRAME)
|
|
AppInstall(m, "Calendar", web.TEAM_PLAN, ctx.ARGS, team.MONTH)
|
|
AppInstall(m, "Terminal", web.CODE_XTERM)
|
|
AppInstall(m, "Grapher", web.WIKI_DRAW)
|
|
AppInstall(m, "Photos", web.WIKI_FEEL)
|
|
AppInstall(m, "Books", web.WIKI_WORD)
|
|
AppInstall(m, "", web.CODE_VIMER)
|
|
AppInstall(m, "", web.CHAT_FAVOR)
|
|
AppInstall(m, "", web.DREAM)
|
|
if m.Cmd(DESKTOP).Length() == 0 {
|
|
DeskAppend(m, "Books", web.WIKI_WORD)
|
|
DeskAppend(m, "Photos", web.WIKI_FEEL)
|
|
DeskAppend(m, "Grapher", web.WIKI_DRAW)
|
|
DeskAppend(m, "Calendar", web.TEAM_PLAN, ctx.ARGS, team.MONTH)
|
|
DeskAppend(m, "", web.CHAT_FAVOR)
|
|
}
|
|
if m.Cmd(DOCK).Length() == 0 {
|
|
DockAppend(m, "Finder", Prefix(FINDER))
|
|
DockAppend(m, "Safari", web.CHAT_IFRAME)
|
|
DockAppend(m, "Terminal", web.CODE_XTERM)
|
|
DockAppend(m, "", web.CODE_GIT_REPOS, mdb.ICON, "usr/icons/git.jpg")
|
|
DockAppend(m, "", web.CODE_COMPILE, mdb.ICON, "usr/icons/go.png")
|
|
DockAppend(m, "", web.CODE_VIMER)
|
|
DockAppend(m, "", web.DREAM)
|
|
}
|
|
}},
|
|
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1], arg[2:]...) }},
|
|
}, CmdHashAction("index,args"))},
|
|
})
|
|
}
|
|
func install(m *ice.Message, cmd, name, index string, arg ...string) {
|
|
name, icon := kit.Select(kit.Select("", kit.Split(index, ice.PT), -1), name), ""
|
|
kit.If(nfs.Exists(m, kit.PathJoin(USR_ICONS, name, nfs.PNG)), func() { icon = kit.PathJoin(USR_ICONS, name, nfs.PNG) })
|
|
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
|
}
|
|
func AppInstall(m *ice.Message, name, index string, arg ...string) {
|
|
install(m, APPLICATIONS, name, index, arg...)
|
|
}
|