mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 01:04:06 +08:00
add applications
This commit is contained in:
parent
d97767507c
commit
5259773d90
18
src/macosx/applications.go
Normal file
18
src/macosx/applications.go
Normal file
@ -0,0 +1,18 @@
|
||||
package macosx
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const APPLICATIONS = "applications"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
APPLICATIONS: {Name: "applications hash auto create", Help: "应用", Actions: CmdHashAction("index,args"), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).Options(ice.MSG_HEIGHT, kit.Select("240", "32", len(arg) == 0)).Table(func(value ice.Maps) { m.PushImages(web.IMAGE, "/require/"+value[mdb.ICON]) })
|
||||
}},
|
||||
})
|
||||
}
|
@ -32,6 +32,9 @@ fieldset.macosx.dock>div.output>div.item { text-align:center; align-self:baselin
|
||||
fieldset.macosx.dock>div.output>div.item:hover { background-color:unset; margin-top:-80px; transition:margin-top 0.3s; }
|
||||
fieldset.macosx.dock>div.output>div.item img { width:80px; transition:width 0.3s; }
|
||||
fieldset.macosx.dock>div.output>div.item img:hover { width:160px; transition:width 0.3s; }
|
||||
fieldset.macosx.finder>div.output div.content>div.item { float:left; text-align:center; }
|
||||
fieldset.macosx.finder>div.output div.content>div.item img { width:84px; }
|
||||
fieldset.macosx.finder>div.output div.content>div.item div.name { text-align:center; }
|
||||
div.carte.macosx.float { font-size:14px; padding:10px; border:#ffffff5e solid 1px; border-radius:8px; }
|
||||
div.carte.macosx.float div.item { background:transparent; }
|
||||
div.carte.macosx.float hr { border-bottom:gray solid 1px; }
|
||||
|
@ -40,6 +40,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
"#32c840": function(event) { sub.onaction.full(event, sub) },
|
||||
}, function(color, cb) { can.page.insertBefore(can, [{view: [[html.ITEM, html.BUTTON]], style: {"background-color": color, right: 10+20*index++}, onclick: cb}], sub._output) })
|
||||
sub.onimport.size(sub, item.height, item.width, true), can.onmotion.move(can, sub._target, {"z-index": 10, top: 25, left: 100})
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
}, can.ui.desktop)
|
||||
},
|
||||
layout: function(can) { can.page.styleHeight(can, can._output, can.ConfHeight()) },
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -13,9 +14,26 @@ const FINDER = "finder"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FINDER: {Name: "finder path auto create", Actions: CmdHashAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || strings.HasSuffix(arg[0], nfs.PS) {
|
||||
switch kit.Select("", arg, 0) {
|
||||
FINDER: {Name: "finder list", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(APPLICATIONS, mdb.CREATE, mdb.NAME, "Finder", mdb.ICON, "usr/icons/Finder.png", ctx.INDEX, m.PrefixKey())
|
||||
m.Cmd(APPLICATIONS, mdb.CREATE, mdb.NAME, "Safari", mdb.ICON, "usr/icons/Safari.png", ctx.INDEX, "web.chat.iframe")
|
||||
m.Cmd(APPLICATIONS, mdb.CREATE, mdb.NAME, "Preview", mdb.ICON, "usr/icons/Preview.png", ctx.INDEX, "web.wiki.feel")
|
||||
m.Cmd(APPLICATIONS, mdb.CREATE, mdb.NAME, "Terminal", mdb.ICON, "usr/icons/Terminal.png", ctx.INDEX, "web.code.xterm")
|
||||
m.Cmd(APPLICATIONS, mdb.CREATE, mdb.NAME, "vim", mdb.ICON, "usr/icons/vim.png", ctx.INDEX, "web.code.vimer")
|
||||
if m.Cmd(DOCK).Length() == 0 {
|
||||
m.Cmd(DOCK, mdb.CREATE, mdb.NAME, "Finder", mdb.ICON, "usr/icons/Finder.png", ctx.INDEX, m.PrefixKey())
|
||||
m.Cmd(DOCK, mdb.CREATE, mdb.NAME, "Terminal", mdb.ICON, "usr/icons/Terminal.png", ctx.INDEX, "web.code.xterm")
|
||||
}
|
||||
m.Cmd(FINDER, mdb.CREATE, mdb.NAME, "Applications", ctx.INDEX, Prefix(APPLICATIONS))
|
||||
m.Cmd(FINDER, mdb.CREATE, mdb.NAME, "contexts", ctx.INDEX, "nfs.dir")
|
||||
}},
|
||||
}, CmdHashAction(mdb.NAME)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...)
|
||||
m.Display("")
|
||||
} else if len(arg) == 1 || strings.HasSuffix(arg[1], nfs.PS) {
|
||||
switch kit.Select("", arg, 1) {
|
||||
case ice.USR_LOCAL_WORK:
|
||||
ctx.ProcessCmds(m, "web.dream")
|
||||
case ice.USR_LOCAL_REPOS:
|
||||
@ -25,16 +43,16 @@ func init() {
|
||||
case ice.USR_LOCAL_DAEMON:
|
||||
ctx.ProcessCmds(m, "web.code.install")
|
||||
default:
|
||||
m.Cmdy(nfs.DIR, arg).Display("")
|
||||
m.Cmdy(nfs.DIR, arg[1:]).Display("")
|
||||
}
|
||||
} else {
|
||||
switch kit.Ext(arg[0]) {
|
||||
switch kit.Ext(arg[1]) {
|
||||
case "svg":
|
||||
ctx.ProcessCmds(m, "web.wiki.draw", arg[0])
|
||||
ctx.ProcessCmds(m, "web.wiki.draw", arg[1])
|
||||
case "shy":
|
||||
ctx.ProcessCmds(m, "web.wiki.word", arg[0])
|
||||
ctx.ProcessCmds(m, "web.wiki.word", arg[1])
|
||||
default:
|
||||
ls := nfs.SplitPath(m, arg[0])
|
||||
ls := nfs.SplitPath(m, arg[1])
|
||||
ctx.ProcessCmds(m, "web.code.vimer", ls[0], ls[1])
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,28 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||
msg.Dump(can)
|
||||
}})
|
||||
Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onmotion.clear(can), can.ui = can.onappend.layout(can)
|
||||
msg.Table(function(value, index) {
|
||||
var item = can.onimport.item(can, value, function(event) {
|
||||
if (can.onmotion.cache(can, function() { return value.name }, can.ui.content)) { return }
|
||||
can.runActionCommand(event, value.index, [], function(msg) {
|
||||
switch (value.name) {
|
||||
case "Applications":
|
||||
can.onimport.icons(can, msg, can.ui.content)
|
||||
break
|
||||
default:
|
||||
can.onappend.table(can, msg, null, can.ui.content)
|
||||
}
|
||||
can.onimport.layout(can)
|
||||
})
|
||||
}); index == 0 && item.click()
|
||||
})
|
||||
},
|
||||
icons: function(can, msg, target) {
|
||||
msg.Table(function(value) {
|
||||
can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: "/require/"+value.icon}]}, {view: [mdb.NAME, "", value.name]}], onclick: function(event) {
|
||||
can.sup.onexport.record(can.sup, value.name, mdb.NAME, value)
|
||||
}}])
|
||||
})
|
||||
},
|
||||
layout: function(can) {
|
||||
can.ui.layout(can.ConfHeight(), can.ConfWidth())
|
||||
},
|
||||
})
|
||||
|
@ -15,6 +15,8 @@ var Index = &ice.Context{Name: MACOSX}
|
||||
|
||||
func init() { chat.Index.Register(Index, nil) }
|
||||
|
||||
func Prefix(arg ...string) string { return chat.Prefix(MACOSX, kit.Keys(arg)) }
|
||||
|
||||
func CmdHashAction(arg ...string) ice.Actions {
|
||||
file := kit.FileLines(2)
|
||||
return ice.MergeActions(ice.Actions{
|
||||
|
Loading…
x
Reference in New Issue
Block a user