forked from x/ContextOS
opt desktop
This commit is contained in:
parent
947d34a8d2
commit
ad31f2cbcc
@ -7,6 +7,7 @@ import (
|
||||
"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"
|
||||
)
|
||||
|
||||
@ -14,26 +15,27 @@ const APPLICATIONS = "applications"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
APPLICATIONS: {Name: "applications hash auto create", Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
APPLICATIONS: {Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
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")
|
||||
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")
|
||||
FinderAppend(m, "Applications", m.PrefixKey())
|
||||
FinderAppend(m, "Pictures", web.WIKI_FEEL)
|
||||
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)
|
||||
}},
|
||||
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...).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]) })
|
||||
}},
|
||||
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, name, index string, arg ...string) {
|
||||
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(APPLICATIONS), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
||||
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...)
|
||||
}
|
||||
|
@ -1,29 +1,17 @@
|
||||
fieldset.macos.desktop { background-size:cover; background-position:center; }
|
||||
fieldset.macos.desktop>div.output>div.item { text-align:center; width:120px; float:left; overflow:hidden; }
|
||||
fieldset.macos.desktop>div.output>div.item img { width:80px; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos { background-color:transparent; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos>div.output { background-color:transparent; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.menu { line-height:25px; height:25px; width:100%; position:absolute; top:0; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.controls { height:40%; width:240px; position:absolute; top:20px; right:0; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications { height:80%; width:240px; position:absolute; top:10%; right:0; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.dock { border:#ffffff3d solid 1px; border-radius:20px; position:absolute; bottom:10px; left:300px; z-index:11; transition:margin-left 0.3s; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.dock { border:#ffffff3d solid 1px; border-radius:20px; position:absolute; bottom:10px; z-index:11; transition:margin-left 0.3s; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.dock:hover { margin-left:-40px; transition:margin-left 0.3s; }
|
||||
fieldset.macos.desktop>div.output>div.desktop:not(.select) { display:none; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset { position:absolute; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset { border-radius:10px; position:absolute; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.item.button { border-radius:20px; height:20px; width:20px; scale:0.7; position:absolute; top:15px; right:10px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop.scale>fieldset { scale:0.6; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset { border-radius:10px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset>legend { background-color:unset; padding-right:10px; margin:10px 0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>* { margin:10px 0; background-color:unset; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>legend { background-color:unset; padding-right:10px; margin:10px 0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>* { margin:10px 0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.icon { margin-top:12px; margin-bottom:8px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.icons>span.icon { margin-left:5px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>* { margin:10px 0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset>div.status { background-color:transparent; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset fieldset>legend { margin:0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset fieldset>form.option>* { margin:0; background-color:unset; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset fieldset>div.action>* { margin:0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset input { border-radius:5px; box-shadow:unset; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset table.content th { background-color:unset; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset table.content.action td:last-child { background-color:unset; }
|
||||
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; }
|
||||
@ -40,8 +28,6 @@ div.carte.macos.float { font-size:14px; padding:10px; border:#ffffff5e solid 1px
|
||||
div.carte.macos.float div.item { background:transparent; }
|
||||
div.carte.macos.float hr { border-bottom:gray solid 1px; }
|
||||
div.carte.macos.float { background:#e1e5ea; }
|
||||
fieldset.macos.desktop fieldset>form.option>div.item.icons>span.icon { margin-left:5px; }
|
||||
|
||||
body.dark div.carte.macos.float { background:#29323beb; color:#e8eaed; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.dock { background-color:#e9f1f594; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.menu { background-color:#08234ad1; color:#e8eaed; }
|
||||
|
@ -8,40 +8,66 @@ Volcanos(chat.ONIMPORT, {
|
||||
switch (value) {
|
||||
case "system":
|
||||
var carte = can.user.carte(event, can, {
|
||||
"About This Mac": function(event) { can.user.toast(can, "about this mac") },
|
||||
"System Preferences...": function(event) { can.user.toast(can, "about this mac") },
|
||||
"App Store...": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Rencent iterms >": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Force Quit Chrome": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Sleep": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Restart...": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Shut Down...": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Lock Screen": function(event) { can.user.toast(can, "about this mac") },
|
||||
"Log Out shy...": function(event) { can.user.toast(can, "about this mac") },
|
||||
"desktop\t>": function(event) {
|
||||
can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", "create"], onclick: function(event) {
|
||||
can.onaction.create(event, can)
|
||||
}}].concat(can.page.Select(can, can._action, "div.tabs>span.name", function(target) {
|
||||
return {view: [html.ITEM, "", target.innerText+(can.page.ClassList.has(can, target.parentNode, html.SELECT)? " *": "")],
|
||||
onclick: function(event) { target.click() },
|
||||
oncontextmenu: function(event) { can.user.carteRight(event, can, {
|
||||
remove: function() { target.parentNode._close() },
|
||||
}, [], function() {}, carte) },
|
||||
}
|
||||
})), function(event) {}, carte)
|
||||
},
|
||||
"window\t>": function(event) {
|
||||
can.user.carteRight(event, can, {}, can.page.Select(can, can.ui.desktop, "fieldset>legend", function(legend) {
|
||||
return {view: [html.ITEM, "", legend.innerText+(legend.parentNode.style["z-index"] == "10"? " *": "")], onclick: function(event) {
|
||||
can.ondetail.select(can, legend.parentNode)
|
||||
}}
|
||||
}), function(event) {}, carte)
|
||||
},
|
||||
"layout\t>": function(event) {
|
||||
can.user.carteRight(event, can, {
|
||||
grid: function(event) { var list = can.page.SelectChild(can, can.ui.desktop, "fieldset")
|
||||
for (var i = 0; i*i < list.length; i++) {} for (var j = 0; j*i < list.length; j++) {}
|
||||
var height = (can.ConfHeight()-25)/j, width = can.ConfWidth()/i
|
||||
can.core.List(list, function(target, index) {
|
||||
can.page.style(can, target, html.TOP, parseInt(index/i)*height+25, html.LEFT, index%i*width)
|
||||
target._can.onimport.size(target._can, height, width)
|
||||
})
|
||||
},
|
||||
free: function(event) { var list = can.page.SelectChild(can, can.ui.desktop, "fieldset")
|
||||
can.core.List(list, function(target, index) {
|
||||
can.page.style(can, target, html.TOP, can.ConfHeight()/2/list.length*index+25, html.LEFT, can.ConfWidth()/2/list.length*index)
|
||||
})
|
||||
},
|
||||
}, [], function(event) {}, carte)
|
||||
},
|
||||
full: function(event) { can.onaction.full(event, can) },
|
||||
scale: function(event) { can.page.ClassList.neg(can, can.ui.desktop, "scale") },
|
||||
}); var list = can.page.Select(can, carte._target, html.DIV_ITEM)
|
||||
can.core.List([1, 3, 4, 5, 8], function(i) { can.page.insertBefore(can, [{type: html.HR}], list[i]) })
|
||||
break
|
||||
}); break
|
||||
}
|
||||
}
|
||||
}) },
|
||||
_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) }
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
}) },
|
||||
_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: 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) })
|
||||
can.onimport.tabs(can, [{name: "desktop"+(can.page.Select(can, can._output, "div.desktop").length-1)}], function() { can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target }, function() { can.page.Remove(can, target) })._desktop = target
|
||||
},
|
||||
_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) {
|
||||
_window: function(can, item) {
|
||||
item.height = can.base.Min(can.ConfHeight()-400, 320, 800), item.width = can.base.Min(can.ConfWidth()-400, 480, 1000)
|
||||
can.onappend.plugin(can, item, function(sub) { can.ondetail.select(can, sub._target)
|
||||
var index = 0; can.core.Item({
|
||||
"#f95f57": function(event) { sub.onaction.close(event, sub) },
|
||||
"#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})
|
||||
sub.onimport.size(sub, item.height, item.width, true), can.onmotion.move(can, sub._target, {"z-index": 10, top: 125, left: 100})
|
||||
sub.onmotion.resize(can, sub._target, function(height, width) { sub.onimport.size(sub, height, width) }, 25)
|
||||
sub.onexport.actionHeight = function(sub) { return can.page.ClassList.has(can, sub._target, html.OUTPUT)? 0: html.ACTION_HEIGHT+20 },
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
}, can.ui.desktop)
|
||||
},
|
||||
@ -51,3 +77,11 @@ Volcanos(chat.ONACTION, {list: ["full"],
|
||||
create: function(event, can, button) { can.onimport._desktop(can) },
|
||||
full: function(event, can) { document.body.requestFullscreen() },
|
||||
})
|
||||
Volcanos(chat.ONDETAIL, {
|
||||
select: function(can, target) {
|
||||
can.page.SelectChild(can, can.ui.desktop, "fieldset", function(fieldset) {
|
||||
can.page.style(can, fieldset, "z-index", fieldset == target? "10": "9")
|
||||
fieldset == target && can.onmotion.toggle(can, fieldset, true)
|
||||
})
|
||||
},
|
||||
})
|
||||
|
@ -1,7 +1,13 @@
|
||||
package macos
|
||||
|
||||
import ice "shylinux.com/x/icebergs"
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
)
|
||||
|
||||
const DOCK = "dock"
|
||||
|
||||
func init() { Index.MergeCommands(ice.Commands{DOCK: {Actions: CmdHashAction()}}) }
|
||||
|
||||
func DockAppend(m *ice.Message, name, index string, arg ...string) {
|
||||
install(m, DOCK, name, index, arg...)
|
||||
}
|
||||
|
@ -2,12 +2,9 @@ package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const FINDER = "finder"
|
||||
@ -29,8 +26,7 @@ func init() {
|
||||
}, 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)
|
||||
|
||||
func FinderAppend(m *ice.Message, name, index string, arg ...string) {
|
||||
install(m, FINDER, name, index, arg...)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user