forked from x/ContextOS
opt macos
This commit is contained in:
parent
d542864c2b
commit
525cf8bf08
11
etc/init.shy
11
etc/init.shy
@ -1,3 +1,6 @@
|
||||
~web
|
||||
spide create name "com" link "http://2021.shylinux.com:9020"
|
||||
|
||||
~web.code.input
|
||||
# wubi load file usr/wubi-dict/wubi86
|
||||
# wubi load file usr/wubi-dict/person zone person
|
||||
@ -13,7 +16,15 @@
|
||||
applications install "" nfs.trash
|
||||
applications install "" web.dream
|
||||
applications install "" web.space
|
||||
applications install "" web.chat.favor
|
||||
applications install "" web.code.vimer
|
||||
applications install "go" web.code.compile icon "usr/icons/go.png"
|
||||
applications install "git" web.code.git.status icon "usr/icons/git.jpeg"
|
||||
applications install "Docker" web.code.docker.client icon "usr/icons/Docker.png"
|
||||
applications install "QuickTime" web.chat.macos.opens args "QuickTime Player" icon "usr/icons/QuickTime Player.png"
|
||||
applications install "Preferences" web.chat.macos.opens args "System Preferences" icon "usr/icons/System Preferences.png"
|
||||
applications install "Activity" web.chat.macos.opens args "Activity Monitor" icon "usr/icons/Activity Monitor.png"
|
||||
applications install "Preview" web.chat.macos.opens args "Preview"
|
||||
|
||||
~aaa
|
||||
role white void web.code.git.trend
|
||||
|
@ -1,42 +0,0 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"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) {
|
||||
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)
|
||||
m.Cmd(NOTIFICATIONS, mdb.CREATE, mdb.NAME, "runtime", mdb.TEXT, "系统启动成功", ctx.INDEX, "cli.runtime")
|
||||
}},
|
||||
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...)
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
fieldset.macos.desktop { background-size:cover; background-position:center; }
|
||||
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; border-radius:0; height:25px; width:100%; position:absolute; top:0; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.searchs { position:absolute; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications { height:calc(100% - 25px); width:250px; overflow:auto; position:absolute; top:25px; right:0; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item { margin-top:10px; margin-right:10px; min-height:60px; clear:both; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.title { padding-top:10px; height:24px; width:132px; overflow:hidden; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.time { font-size:12px; color:gray; padding:5px; padding-top:10px; height:24px; width:48px; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.content { width:180px; }
|
||||
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 { padding-top:25px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>div.item { position:absolute; text-align:center; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>div.item:hover { background-color:unset; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>div.item img { width:80px; border-radius:80px; }
|
||||
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>fieldset>legend { background-color:unset; padding-right:10px; margin:10px 0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>* { margin:10px 0px 10px 10px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.icon { margin-left:0; margin-top:12px; margin-bottom:8px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item.icons { margin-left:0; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.item:last-child { margin-right:20px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>* { margin:10px 0px 10px 10px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.item.icons>span.icon { margin-top:12px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.item:last-child { margin-right:80px; }
|
||||
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.menu>div.output>div.menu { float:left; padding:0 20px; cursor:pointer; }
|
||||
fieldset.macos.dock>div.output { height:80px; overflow:visible; display:flex; }
|
||||
fieldset.macos.dock>div.output>div.space { background-color:#ececec36; margin:10px; height:calc(100% - 20px); width:2px; }
|
||||
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; }
|
||||
fieldset.macos.dock>div.output>div.item img:hover { width:160px; transition:width 0.3s; }
|
||||
fieldset.macos.finder>div.output div.content>div.item { float:left; text-align:center; }
|
||||
fieldset.macos.finder>div.output div.content>div.item img { width:80px; border-radius:80px; }
|
||||
fieldset.macos.finder>div.output div.content>div.item div.name { text-align:center; }
|
||||
div.carte.macos.float { font-size:14px; padding:10px; border:#ffffff5e solid 1px; border-radius:8px; }
|
||||
div.carte.macos.float div.item { background:transparent; }
|
||||
div.carte.macos.float hr { border-bottom:gray solid 1px; }
|
||||
div.carte.macos.float { background:#e1e5ea; }
|
||||
body.dark div.carte.macos.float { background:#29323beb; color:#e8eaed; }
|
||||
fieldset.macos.desktop>div.output { color:white; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.dock { background-color:#e9f1f594; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.menu { background-color:#daefff99; color:black; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.controls { background-color:#08234ad1; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item { background-color:#daefff99; color:black; }
|
||||
fieldset.macos.desktop>div.output>div.search { background-color:#daefff99; color:black; }
|
||||
fieldset.macos.desktop>div.output>fieldset.macos.searchs { background-color:#daefff99; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset { background-color:#dee1e6; }
|
||||
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output { background-color:white; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset>div.status { border-top:#dddede solid 1px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset table.content tr:nth-child(odd) { background-color:white; color:black; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset table.content tr:nth-child(even) { background-color:#f4f5f5; color:black; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset input { background-color:white; border:#e4e5e5 solid 1px; color:black; caret-color:black; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset>div.output.card>div.item { border:#d3d4d4 solid 1px; }
|
||||
fieldset.macos.desktop>div.output>div.desktop fieldset>div.output.card>div.item>div.title { border-bottom:#d3d4d4 solid 1px; }
|
||||
body.dark fieldset.macos.desktop input { color:#e8eaed; }
|
||||
body.dark fieldset.macos.desktop input[type=button] { background-color:#5e5f5f; }
|
||||
body.dark fieldset.macos.desktop>div.output { color:white; }
|
||||
body.dark fieldset.macos.desktop>div.output { background-color:unset; }
|
||||
body.dark fieldset.macos.desktop>div.output>fieldset.macos.dock { background-color:#0e202e70; }
|
||||
body.dark fieldset.macos.desktop>div.output>fieldset.macos.menu { background-color:#08234ad1; color:#e8eaed; }
|
||||
body.dark fieldset.macos.desktop>div.output>fieldset.macos.controls { background-color:#08234ad1; }
|
||||
body.dark fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item { background-color:#08234ad1; color:white; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset { background-color:#333434; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output { background-color:#1a1d1d; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset>div.status { border-top:#3e4040 solid 1px; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset table.content tr:nth-child(odd) { background-color:#1a1d1e; color:white; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset table.content tr:nth-child(even) { background-color:#282B2F; color:white; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset input { background-color:#333434; border:#404141 solid 1px; color:white; caret-color:white; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset>div.output.card>div.item { border:#3e4040 solid 1px; }
|
||||
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset>div.output.card>div.item>div.title { border-bottom:#3e4040 solid 1px; }
|
||||
body.light fieldset.macos.desktop>div.output { background-color:unset; }
|
||||
body.black fieldset.macos.desktop>div.output>div.desktop fieldset { background-color:#3433337a; }
|
||||
body.black fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output { background-color:#1a1d1d9c; }
|
||||
body.black fieldset.macos.desktop>div.output>div.desktop fieldset table.content tr:nth-child(odd) { background-color:#1a1d1ee0; color:white; }
|
||||
body.black fieldset.macos.desktop>div.output>div.desktop fieldset table.content tr:nth-child(even) { background-color:#282b2fc7; color:white; }
|
||||
body.white fieldset.macos.desktop>div.output>div.desktop fieldset { background-color:#f5f5f594; }
|
||||
body.white fieldset.macos.desktop>div.output>div.desktop fieldset>legend { color:black; }
|
||||
body.white fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output { background-color:#ffffff94; }
|
@ -1,7 +0,0 @@
|
||||
package macos
|
||||
|
||||
import ice "shylinux.com/x/icebergs"
|
||||
|
||||
const DESKTOP = "desktop"
|
||||
|
||||
func init() { Index.MergeCommands(ice.Commands{DESKTOP: {Actions: CmdHashAction()}}) }
|
@ -1,146 +0,0 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg, cb) { if (can.isCmdMode()) { can.onappend.style(can, html.OUTPUT), can.ConfHeight(can.page.height()) }
|
||||
can.ui = {}, can.base.isFunc(cb) && cb(msg), can.onmotion.clear(can), can.page.styleHeight(can, can._output, can.ConfHeight())
|
||||
can.onimport._menu(can), can.onimport._dock(can), can.onimport._desktop(can, msg), can.onlayout.background(can, can.user.info.background, can._fields)
|
||||
can.onimport._notifications(can)
|
||||
},
|
||||
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub
|
||||
sub.onexport.record = function(_, value, key, item) { delete(can.onfigure._path)
|
||||
switch (value) {
|
||||
case "system": var carte = can.user.carte(event, can, {}, can.core.Item(can.onfigure), function(event, button, meta, carte) { can.onfigure[button](event, can, carte) }); break
|
||||
case "searchs": can.onimport._searchs(can); break
|
||||
case "notifications": can.onmotion.toggle(can, can.ui.notifications._target); break
|
||||
}
|
||||
}
|
||||
}) },
|
||||
_searchs: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.searchs"}, function(sub) { can.ui.searchs = sub
|
||||
can.page.style(can, sub._target, html.LEFT, can.ConfWidth()/4, html.TOP, can.ConfHeight()/4)
|
||||
sub.onimport.size(sub, can.ConfHeight()/2, can.ConfWidth()/2, true)
|
||||
sub.onexport.record = function(sub, value, key, item) {
|
||||
if (item.cmd == ctx.COMMAND) {
|
||||
can.onimport._window(can, {index: can.core.Keys(item.type, item.name.split(lex.SP)[0])})
|
||||
}
|
||||
}
|
||||
}) },
|
||||
_notifications: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.notifications", style: html.OUTPUT}, function(sub) { can.ui.notifications = sub
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
}) },
|
||||
_dock: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.dock", style: html.OUTPUT}, function(sub) { can.ui.dock = sub
|
||||
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) }
|
||||
}) },
|
||||
_item: function(can, item) { can.runAction(can.request(event, item), mdb.CREATE, [], function() { can.run(event, [], function(msg) {
|
||||
can.page.SelectChild(can, can.ui.desktop, html.DIV_ITEM, function(target) { can.page.Remove(can, target) })
|
||||
can.onimport.__item(can, msg, can.ui.desktop)
|
||||
}) }) },
|
||||
__item: function(can, msg, target) { msg = msg||can._msg, msg.Table(function(item, index) {
|
||||
can.page.Append(can, target, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: can.misc.PathJoin(item.icon)}]}, {view: [mdb.NAME, "", item.name]}],
|
||||
onclick: function(event) { can.onimport._window(can, item) }, style: can.onexport.position(can, index),
|
||||
oncontextmenu: function(event) { var carte = can.user.carteRight(event, can, {
|
||||
remove: function() { can.runAction(event, mdb.REMOVE, [item.hash]) },
|
||||
}); can.page.style(can, carte._target, html.TOP, event.y) },
|
||||
}])
|
||||
}) },
|
||||
_desktop: function(can, msg) { var target = can.page.Append(can, can._output, [{view: html.DESKTOP}])._target; can.onimport.__item(can, msg, target)
|
||||
target._tabs = can.onimport.tabs(can, [{name: html.DESKTOP+(can.page.Select(can, can._output, html.DIV_DESKTOP).length-1)}], function() { can.onmotion.select(can, can._output, "div.desktop", target), can.ui.desktop = target }, function() { can.page.Remove(can, target) }), target._tabs._desktop = target
|
||||
target.ondragend = function() { can.onimport._item(can, window._drag_item) }
|
||||
can.ui.desktop = target
|
||||
return target
|
||||
},
|
||||
_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) {
|
||||
var dock = can.page.Append(can, can.ui.dock._output, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: can.misc.PathJoin(item.icon)}]}], onclick: function() {
|
||||
can.onmotion.toggle(can, sub._target, true), can.page.Remove(can, dock)
|
||||
}}])._target; 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.onexport.marginTop = function() { return 25 }
|
||||
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) }
|
||||
sub.onappend.dock = function(item) { can.ui.dock.runAction(can.request(event, item), mdb.CREATE, [], function() { can.ui.dock.Update() }) }
|
||||
sub.onappend.desktop = function(item) { can.onimport._item(can, item) }
|
||||
}, can.ui.desktop)
|
||||
},
|
||||
session: function(can, list) { can.page.Select(can, can._output, html.DIV_DESKTOP, function(target) { can.page.Remove(can, target) }), can.onmotion.clear(can, can._action)
|
||||
can.core.List(list, function(item) { can.onimport._desktop(can), can.core.List(item.list, function(item) { can.onimport._window(can, item) }) })
|
||||
},
|
||||
layout: function(can) { can.page.styleHeight(can, can._output, can.ConfHeight()) },
|
||||
}, [""])
|
||||
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, html.FIELDSET, function(fieldset) {
|
||||
can.page.style(can, fieldset, "z-index", fieldset == target? "10": "9"), fieldset == target && can.onmotion.toggle(can, fieldset, true)
|
||||
}) },
|
||||
})
|
||||
Volcanos(chat.ONFIGURE, {
|
||||
"session\t>": function(event, can, carte) { can.runActionCommand(event, "session", [], function(msg) {
|
||||
var _carte = can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", mdb.CREATE], onclick: function(event) {
|
||||
can.user.input(event, can, [mdb.NAME], function(list) {
|
||||
var args = can.page.SelectChild(can, can._output, html.DIV_DESKTOP, function(target) {
|
||||
return {name: can.page.Select(can, target._tabs, html.SPAN_NAME).innerText, list: can.page.SelectChild(can, target, html.FIELDSET, function(target) {
|
||||
return {index: target._can._index, args: target._can.onexport.args(target._can), style: {left: target.offsetLeft, top: target.offsetTop}}
|
||||
})}
|
||||
})
|
||||
can.runActionCommand(event, "session", [ctx.ACTION, mdb.CREATE, mdb.NAME, list[0], ctx.ARGS, JSON.stringify(args)], function(msg) {
|
||||
can.user.toastSuccess(can, "session created")
|
||||
})
|
||||
})
|
||||
}}].concat("", msg.Table(function(value) {
|
||||
return {view: [html.ITEM, "", value.name],
|
||||
onclick: function() { can.onimport.session(can, can.base.Obj(value.args, [])) },
|
||||
oncontextmenu: function(event) { can.user.carteRight(event, can, {
|
||||
remove: function() { can.runActionCommand(event, "session", [mdb.REMOVE, value.name], function() { can.user.toastSuccess(can, "session removed") }) },
|
||||
}, [], function() {}, _carte) },
|
||||
}
|
||||
})), function(event) {}, carte)
|
||||
}) },
|
||||
"desktop\t>": function(event, can, carte) {
|
||||
var _carte = can.user.carteRight(event, can, {}, [{view: [html.ITEM, "", mdb.CREATE], onclick: function(event) {
|
||||
can.onaction.create(event, can), can.user.toastSuccess(can, "desktop created")
|
||||
}}].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(), can.user.toastSuccess(can, "desktop removed") },
|
||||
}, [], function() {}, _carte) },
|
||||
}
|
||||
})), function(event) {}, carte)
|
||||
},
|
||||
"window\t>": function(event, can, carte) {
|
||||
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, carte) { var list = can.page.SelectChild(can, can.ui.desktop, html.FIELDSET)
|
||||
can.user.carteRight(event, can, {
|
||||
grid: function(event) { 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) { 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)
|
||||
}) },
|
||||
full: function(event) { can.onaction.full(event, can) },
|
||||
}, [], function(event) {}, carte)
|
||||
},
|
||||
})
|
||||
Volcanos(chat.ONEXPORT, {
|
||||
position: function(can, index) { var top = 25, margin = 20, height = 100, width = 80
|
||||
var n = parseInt((can.ConfHeight()-top)/(height+margin))
|
||||
return {top: index%n*height+top+margin/2, left: parseInt(index/n)*(width+margin)+margin/2}
|
||||
}
|
||||
})
|
@ -1,13 +0,0 @@
|
||||
package macos
|
||||
|
||||
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...)
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||
function show(msg) { can.onmotion.clear(can)
|
||||
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) },
|
||||
oncontextmenu: function(event) {
|
||||
var carte = can.user.carte(event, can, {
|
||||
remove: function() { item.name != "Finder" && can.runAction(event, mdb.REMOVE, [item.hash]) },
|
||||
}); can.page.style(can, carte._target, html.LEFT, event.x)
|
||||
},
|
||||
}]) })
|
||||
} show(msg)
|
||||
can.page.Append(can, can._output, [{view: "space"}])
|
||||
|
||||
can._output.ondragend = function() {
|
||||
var args = []; can.core.Item(window._drag_item, function(key, value) { args.push(key, value) })
|
||||
can.runAction(event, mdb.CREATE, args, function() { can.run(event, [], function(msg) { can.onmotion.clear(can, target), show(msg) }) })
|
||||
}
|
||||
return
|
||||
var current = null, before, begin
|
||||
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, mdb.FOREACH, function(target) { can.page.style(can, target, {position: "", left: "", visibility: html.VISIBLE}) })
|
||||
}
|
||||
})
|
||||
}})
|
@ -1,32 +0,0 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
)
|
||||
|
||||
const FINDER = "finder"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
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 {
|
||||
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) {
|
||||
mdb.IsSearchForEach(m, arg, func() []string { return []string{web.LINK, DESKTOP, m.MergePodCmd("", DESKTOP, log.DEBUG, ice.TRUE)} })
|
||||
}},
|
||||
}, CmdHashAction(mdb.NAME))},
|
||||
})
|
||||
}
|
||||
|
||||
func FinderAppend(m *ice.Message, name, index string, arg ...string) {
|
||||
install(m, FINDER, name, index, arg...)
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
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()
|
||||
}), can.onmotion.hidden(can, can.ui.profile), can.onmotion.hidden(can, can.ui.display) },
|
||||
icons: function(can, msg, target) { msg.Table(function(value) { value.icon = can.misc.PathJoin(value.icon||can.page.drawText(can, value.name, 80))
|
||||
var item = 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)
|
||||
}, oncontextmenu: function(event) {
|
||||
can.user.carteRight(event, can, {
|
||||
"add to desktop": function() {
|
||||
can.sup.onappend.desktop(value)
|
||||
},
|
||||
"add to dock": function() {
|
||||
can.sup.onappend.dock(value)
|
||||
},
|
||||
}, [])
|
||||
}}])._target
|
||||
item.draggable = true, item.ondragstart = function(event) { window._drag_item = value }
|
||||
}) },
|
||||
layout: function(can) { can.ui.layout(can.ConfHeight(), can.ConfWidth()) },
|
||||
})
|
@ -1,39 +0,0 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/core/chat"
|
||||
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) }}}}
|
||||
|
||||
func init() { chat.Index.Register(Index, nil, DESKTOP) }
|
||||
|
||||
func Prefix(arg ...string) string { return chat.Prefix(MACOS, kit.Keys(arg)) }
|
||||
|
||||
func CmdHashAction(arg ...string) ice.Actions {
|
||||
file := kit.FileLines(2)
|
||||
return ice.MergeActions(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)) })
|
||||
case mdb.ICON:
|
||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
||||
case mdb.SEARCH:
|
||||
m.OptionFields("type,name,text")
|
||||
m.Cmdy(mdb.SEARCH, "*", "")
|
||||
}
|
||||
}},
|
||||
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,text,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
title "MacOS"
|
||||
chain `
|
||||
desktop
|
||||
menu
|
||||
session
|
||||
desktop
|
||||
window
|
||||
layout
|
||||
dock
|
||||
Finder
|
||||
Applications
|
||||
Pictures
|
||||
Safari
|
||||
Terminal
|
||||
`
|
@ -1,7 +0,0 @@
|
||||
package macos
|
||||
|
||||
import ice "shylinux.com/x/icebergs"
|
||||
|
||||
const MENU = "menu"
|
||||
|
||||
func init() { Index.MergeCommands(ice.Commands{MENU: {Actions: CmdHashAction()}}) }
|
@ -1,11 +0,0 @@
|
||||
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: ["menu", "", "desktop"], onclick: function(event) {
|
||||
can.sup.onexport.record(can, "system", mdb.NAME, {})
|
||||
}}])
|
||||
can.page.Append(can, can._output, [{view: ["item", "", "notifications"], onclick: function(event) {
|
||||
can.sup.onexport.record(can, "notifications", mdb.NAME, {})
|
||||
}}])
|
||||
can.page.Append(can, can._output, [{view: ["item", "", "searchs"], onclick: function(event) {
|
||||
can.sup.onexport.record(can, "searchs", mdb.NAME, {})
|
||||
}}])
|
||||
}})
|
@ -1,14 +0,0 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
const NOTIFICATIONS = "notifications"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{NOTIFICATIONS: {Name: "notifications list", Actions: CmdHashAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).SortStrR(mdb.TIME).Display("")
|
||||
}}})
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.Append(can, can._output, msg.Table(function(item) {
|
||||
return {view: html.ITEM, _init: function(target) {
|
||||
target.onclick = function(event) { can.sup.onexport.record(can.sup, item.index, ctx.INDEX, item)
|
||||
can.runAction(event, mdb.REMOVE, [item.hash], function() { can.page.Remove(can, target) })
|
||||
}
|
||||
var ui = can.onappend.layout(can, [html.ICON, [[wiki.TITLE, mdb.TIME], wiki.CONTENT]], "", target)
|
||||
can.page.Append(can, ui.icon, [{img: can.misc.PathJoin(item.icon||can.page.drawText(can, item.index, 60))}])
|
||||
ui.time.innerHTML = item.time.split(lex.SP).pop().split(nfs.DF).slice(0, 2).join(nfs.DF)
|
||||
ui.title.innerHTML = item.name||"", ui.content.innerHTML = item.text||""
|
||||
}}
|
||||
})) }})
|
@ -1,17 +0,0 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const SEARCHS = "searchs"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SEARCHS: {Name: "search keyword list", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(mdb.SEARCH, "*", kit.Select("", arg, 0), "ctx,cmd,type,name,text")
|
||||
}},
|
||||
})
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
const SESSION = "session"
|
||||
|
||||
func init() { Index.MergeCommands(ice.Commands{SESSION: {Actions: CmdHashAction(mdb.NAME)}}) }
|
@ -30,8 +30,6 @@ import (
|
||||
_ "shylinux.com/x/golang-story/src/grafana"
|
||||
_ "shylinux.com/x/golang-story/src/kubernetes"
|
||||
_ "shylinux.com/x/golang-story/src/prometheus"
|
||||
|
||||
_ "shylinux.com/x/contexts/src/macos"
|
||||
)
|
||||
|
||||
func main() { print(ice.Run()) }
|
||||
|
@ -15,4 +15,4 @@ body.black div.zone>div.list>div.zone>div.item { background-color:#09466fc2; }
|
||||
body.black div.tabs div:hover { background-color:unset; color:white }
|
||||
body.black div.tabs div.select { background-color:unset; color:white }
|
||||
body.black select, body.black input[type=text], body.black textarea { box-shadow:4px 4px 20px 4px #626bd0; }
|
||||
body.dark fieldset:not(.panel) { background-color:#061c3ceb; border-radius:10px; }
|
||||
body.black fieldset:not(.panel) { background-color:#061c3ceb; border-radius:10px; }
|
Loading…
x
Reference in New Issue
Block a user