mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 16:58:06 +08:00
opt some
This commit is contained in:
parent
28820ac34d
commit
947d34a8d2
@ -27,5 +27,5 @@
|
||||
event listen event dream.create cmd web.code.tmux.session
|
||||
|
||||
~ssh
|
||||
target web.code
|
||||
target web.chat.macos
|
||||
source local.shy
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/code"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -15,26 +16,24 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
APPLICATIONS: {Name: "applications hash auto create", Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
Install(m, "Finder", "nfs.dir")
|
||||
Install(m, "Safari", "web.chat.iframe")
|
||||
Install(m, "Photos", "web.wiki.feel")
|
||||
Install(m, "Terminal", "web.code.xterm")
|
||||
Install(m, "Calendar", "web.team.plan", ctx.ARGS, "month")
|
||||
Install(m, "Grapher", "web.wiki.draw")
|
||||
Install(m, "Books", "web.wiki.word")
|
||||
m.Cmd(FINDER, mdb.CREATE, mdb.NAME, "Applications", ctx.INDEX, Prefix(APPLICATIONS))
|
||||
m.Cmd(FINDER, mdb.CREATE, mdb.NAME, "Pictures", ctx.INDEX, "web.wiki.feel")
|
||||
m.Cmd(FINDER, mdb.CREATE, mdb.NAME, "Trash", ctx.INDEX, "nfs.trash")
|
||||
Install(m, "Finder", "nfs.dir")
|
||||
Install(m, "Safari", "web.chat.iframe")
|
||||
Install(m, "Calendar", "web.team.plan", ctx.ARGS, "month")
|
||||
Install(m, "Terminal", "web.code.xterm")
|
||||
Install(m, "Grapher", "web.wiki.draw")
|
||||
Install(m, "Photos", "web.wiki.feel")
|
||||
Install(m, "Books", "web.wiki.word")
|
||||
}},
|
||||
"install": {Hand: func(m *ice.Message, arg ...string) { Install(m, arg[0], arg[1], arg[2:]...) }},
|
||||
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { Install(m, arg[0], arg[1], arg[2:]...) }},
|
||||
}, 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]) })
|
||||
m.Sort(mdb.NAME)
|
||||
mdb.HashSelect(m, arg...).Sort(mdb.NAME).Options(ice.MSG_HEIGHT, kit.Select("240", "32", len(arg) == 0)).Table(func(value ice.Maps) { m.PushImages(web.IMAGE, "/require/"+value[mdb.ICON]) })
|
||||
}},
|
||||
})
|
||||
}
|
||||
func Install(m *ice.Message, name, index string, arg ...string) {
|
||||
name, icon := kit.Select(kit.Select("", kit.Split(index, ice.PT), -1), name), ""
|
||||
kit.If(nfs.Exists(m, "usr/icons/"+name+".png"), func() { icon = "usr/icons/" + name + ".png" })
|
||||
kit.If(nfs.Exists(m, kit.PathJoin(USR_ICONS, name, nfs.PNG)), func() { icon = kit.PathJoin(USR_ICONS, name, nfs.PNG) })
|
||||
m.Cmd(Prefix(APPLICATIONS), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ fieldset.macos.menu>div.output img { margin-bottom:-8px; }
|
||||
fieldset.macos.menu>div.output>div.item { padding:0 5px; float:right; cursor:pointer; }
|
||||
fieldset.macos.menu>div.output>div.item img { height:25px; }
|
||||
fieldset.macos.menu>div.output>div.icon { padding:0 5px; float:right; cursor:pointer; }
|
||||
fieldset.macos.dock>div.output { height:80px; min-width:200px; overflow:visible; display:flex; }
|
||||
fieldset.macos.dock>div.output { height:80px; overflow:visible; display:flex; }
|
||||
fieldset.macos.dock>div.output>div.item { text-align:center; align-self:baseline; transition:margin-top 0.3s; }
|
||||
fieldset.macos.dock>div.output>div.item:hover { background-color:unset; margin-top:-80px; transition:margin-top 0.3s; }
|
||||
fieldset.macos.dock>div.output>div.item img { width:80px; transition:width 0.3s; }
|
||||
|
@ -28,16 +28,17 @@ Volcanos(chat.ONIMPORT, {
|
||||
}) },
|
||||
_dock: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.dock", style: html.OUTPUT}, function(sub) { can.ui.dock = sub
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
sub.onexport.output = function(sub, msg) { can.page.style(can, sub._target, html.LEFT, (can.ConfWidth()-msg.Length()*80)/2) }
|
||||
}) },
|
||||
_desktop: function(can, msg) { var target = can.page.Append(can, can._output, [{view: "desktop"}])._target
|
||||
msg = msg||can._msg, msg.Table(function(item) { can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: "/require/"+item.icon}]}, {view: [mdb.NAME, "", item.name]}]}]) })
|
||||
can.onimport.tabs(can, [{name: "desktop", text: ""}], function() { can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target }, function() { can.page.Remove(can, target) })
|
||||
msg = msg||can._msg, msg.Table(function(item) { can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: can.misc.PathJoin(item.icon)}]}, {view: [mdb.NAME, "", item.name]}]}]) })
|
||||
can.onimport.tabs(can, [{name: "desktop"}], function() { can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target }, function() { can.page.Remove(can, target) })
|
||||
},
|
||||
_window: function(can, item) { item.height = can.ConfHeight()-(item.index == web.CODE_VIMER? 170: 400), item.width = can.base.Max(can.ConfWidth()-200, item.index == web.CODE_VIMER? 2000: 1000)
|
||||
_window: function(can, item) { item.height = can.ConfHeight()-(item.index == web.CODE_VIMER? 400: 400), item.width = can.base.Max(can.ConfWidth()-200, item.index == web.CODE_VIMER? 1000: 1000)
|
||||
can.onappend.plugin(can, item, function(sub) {
|
||||
var index = 0; can.core.Item({
|
||||
"#f95f57": function(event) { sub.onaction.close(event, sub) },
|
||||
"#fcbc2f": function(event) { can.onmotion.hidden(can, sub._target) },
|
||||
"#fcbc2f": function(event) { sub.onmotion.hidden(sub, sub._target) },
|
||||
"#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})
|
||||
|
@ -1,21 +1,18 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg, cb) {
|
||||
msg.Table(function(item) { can.page.Append(can, can._output, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: "/require/"+item.icon}] }], onclick: function(event) {
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||
msg.Table(function(item) { can.page.Append(can, can._output, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: can.misc.PathJoin(item.icon)}] }], onclick: function(event) {
|
||||
can.sup.onexport.record(can, item.name, mdb.NAME, item)
|
||||
} }]) })
|
||||
can._output.oncontextmenu = function(event) { var carte = can.user.carte(event, can, {
|
||||
create: function() { can.Update(event, [ctx.ACTION, mdb.CREATE]) },
|
||||
}); can.page.style(can, carte._target, html.LEFT, event.x) }
|
||||
return
|
||||
var current = null, before, begin
|
||||
can.page.SelectChild(can, can._output, "*", function(target) { target.draggable = true
|
||||
target.ondragstart = function() { current = target, can.page.style(can, target, "visibility", "hidden") }
|
||||
can.page.SelectChild(can, can._output, mdb.FOREACH, function(target) { target.draggable = true
|
||||
target.ondragstart = function() { current = target, can.page.style(can, target, "visibility", html.HIDDEN) }
|
||||
target.ondragenter = function(event) { before = target, begin = {x: event.x, y: event.y} }
|
||||
target.ondragover = function(event) { var offset = event.x - begin.x
|
||||
can.page.style(can, target, {position: "relative", left: -offset})
|
||||
}
|
||||
target.ondragleave = function(event) { }
|
||||
target.ondragend = function(event) { before && can.page.insertBefore(can, current, before)
|
||||
can.page.SelectChild(can, can._output, "*", function(target) { can.page.style(can, target, {position: "", left: "", visibility: "visible"}) })
|
||||
can.page.SelectChild(can, can._output, mdb.FOREACH, function(target) { can.page.style(can, target, {position: "", left: "", visibility: html.VISIBLE}) })
|
||||
}
|
||||
})
|
||||
}})
|
||||
|
@ -1,8 +1,6 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
@ -19,42 +17,20 @@ func init() {
|
||||
FINDER: {Name: "finder list", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
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")
|
||||
DockAppend(m, FINDER, m.PrefixKey())
|
||||
DockAppend(m, "Safari", web.CHAT_IFRAME)
|
||||
DockAppend(m, "Terminal", web.CODE_XTERM)
|
||||
DockAppend(m, "", web.CODE_VIMER)
|
||||
}
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
||||
m.PushSearch(mdb.TYPE, web.LINK, mdb.NAME, DESKTOP, mdb.TEXT, m.MergePodCmd("", Prefix(DESKTOP), log.DEBUG, ice.TRUE))
|
||||
}
|
||||
}},
|
||||
}, CmdHashAction(mdb.NAME)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...).Sort(mdb.NAME).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:
|
||||
ctx.ProcessCmds(m, "web.code.git.service")
|
||||
case ice.USR_LOCAL_IMAGE:
|
||||
ctx.ProcessCmds(m, "web.wiki.feel")
|
||||
case ice.USR_LOCAL_DAEMON:
|
||||
ctx.ProcessCmds(m, "web.code.install")
|
||||
default:
|
||||
m.Cmdy(nfs.DIR, arg[1:]).Display("")
|
||||
}
|
||||
} else {
|
||||
switch kit.Ext(arg[1]) {
|
||||
case "svg":
|
||||
ctx.ProcessCmds(m, "web.wiki.draw", arg[1])
|
||||
case "shy":
|
||||
ctx.ProcessCmds(m, "web.wiki.word", arg[1])
|
||||
default:
|
||||
ls := nfs.SplitPath(m, arg[1])
|
||||
ctx.ProcessCmds(m, "web.code.vimer", ls[0], ls[1])
|
||||
}
|
||||
}
|
||||
mdb.IsSearchForEach(m, arg, func() []string { return []string{web.LINK, DESKTOP, m.MergePodCmd("", DESKTOP, log.DEBUG, ice.TRUE)} })
|
||||
}},
|
||||
}, CmdHashAction(mdb.NAME))},
|
||||
})
|
||||
}
|
||||
func DockAppend(m *ice.Message, 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(DOCK), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
||||
}
|
||||
|
@ -1,28 +1,17 @@
|
||||
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 }
|
||||
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)
|
||||
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) { value.icon = value.icon? "/require/"+value.icon: can.page.drawText(can, value.name, 80)
|
||||
}) },
|
||||
icons: function(can, msg, target) { msg.Table(function(value) { value.icon = can.misc.PathJoin(value.icon||can.page.drawText(can, value.name, 80))
|
||||
can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: 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())
|
||||
},
|
||||
}) },
|
||||
layout: function(can) { can.ui.layout(can.ConfHeight(), can.ConfWidth()) },
|
||||
})
|
||||
|
@ -9,15 +9,14 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const (
|
||||
USR_ICONS = "usr/icons/"
|
||||
)
|
||||
const MACOS = "macos"
|
||||
|
||||
var Index = &ice.Context{Name: MACOS, Commands: ice.Commands{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ice.Info.Load(m).Cmd(FINDER, ice.CTX_INIT)
|
||||
}},
|
||||
}}
|
||||
var Index = &ice.Context{Name: MACOS, Commands: ice.Commands{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { ice.Info.Load(m).Cmd(FINDER, ice.CTX_INIT) }}}}
|
||||
|
||||
func init() { chat.Index.Register(Index, nil) }
|
||||
func init() { chat.Index.Register(Index, nil, DESKTOP) }
|
||||
|
||||
func Prefix(arg ...string) string { return chat.Prefix(MACOS, kit.Keys(arg)) }
|
||||
|
||||
@ -27,11 +26,11 @@ func CmdHashAction(arg ...string) ice.Actions {
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch mdb.HashInputs(m, arg); arg[0] {
|
||||
case mdb.NAME:
|
||||
m.Cmd(nfs.DIR, "usr/icons/", func(value ice.Maps) { m.Push(arg[0], kit.TrimExt(value[nfs.PATH], nfs.PNG)) })
|
||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], kit.TrimExt(value[nfs.PATH], nfs.PNG)) })
|
||||
case mdb.ICON:
|
||||
m.Cmd(nfs.DIR, "usr/icons/", func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
||||
}
|
||||
}},
|
||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m, arg...).Display(file) }},
|
||||
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,type,name,icon,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(file) }},
|
||||
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { msg.Dump(can), can.page.Append(can, can._output, can.user.header(can))
|
||||
can.page.Append(can, can._output, [{view: ["icon"], list: [{img: "/require/usr/icons/menu.png"}], onclick: function(event) {
|
||||
can.page.Append(can, can._output, [{view: ["icon"], list: [{img: can.misc.PathJoin("usr/icons/", "menu", nfs.PNG)}], onclick: function(event) {
|
||||
can.sup.onexport.record(can, "controls", mdb.NAME, {})
|
||||
}}])
|
||||
can.page.Append(can, can._output, [{view: ["menu"], list: [{img: "/require/usr/icons/menu0.png"}], onclick: function(event) {
|
||||
can.page.Append(can, can._output, [{view: ["menu"], list: [{img: can.misc.PathJoin("usr/icons/", "menu0", nfs.PNG)}], onclick: function(event) {
|
||||
can.sup.onexport.record(can, "system", mdb.NAME, {})
|
||||
}}])
|
||||
}})
|
||||
|
Loading…
x
Reference in New Issue
Block a user