This commit is contained in:
Xuan Sang LE 2018-02-28 16:48:09 +01:00
parent c63d2b45f8
commit 077b20e013

View File

@ -126,7 +126,6 @@ self.OS.GUI =
#ok app #ok app
, "script" , "script"
launch: (app, args) -> launch: (app, args) ->
console.log "launching " + app
if not _OS.APP[app] if not _OS.APP[app]
# first load it # first load it
_GUI.loadApp app, _GUI.loadApp app,
@ -184,6 +183,19 @@ self.OS.GUI =
initDM: -> initDM: ->
# check login first # check login first
_API.resource "schemes/dm.html", (x) ->
return null unless x
scheme = $.parseHTML x
($ "#wrapper").append scheme
# system menu and dock
riot.mount ($ "#syspanel", $ "#wrapper")
riot.mount ($ "#sysdock", $ "#wrapper"), { items: [] }
# context menu
riot.mount ($ "#contextmenu")
($ "#workspace").contextmenu (e) -> _GUI.bindContextMenu e
($ window).bind 'keydown', (event) -> ($ window).bind 'keydown', (event) ->
app = ($ "#sysdock")[0].get "selectedApp" app = ($ "#sysdock")[0].get "selectedApp"
return true unless app return true unless app
@ -201,20 +213,6 @@ self.OS.GUI =
return unless fnk return unless fnk
r = app.shortcut fnk, c r = app.shortcut fnk, c
event.preventDefault() if not r event.preventDefault() if not r
_API.resource "schemes/dm.html", (x) ->
return null unless x
scheme = $.parseHTML x
($ "#wrapper").append scheme
# system menu and dock
riot.mount ($ "#syspanel", $ "#wrapper")
riot.mount ($ "#sysdock", $ "#wrapper"), { items: [] }
# context menu
riot.mount ($ "#contextmenu")
($ "#workspace").contextmenu (e) -> _GUI.bindContextMenu e
# desktop default file manager # desktop default file manager
desktop = $ "#desktop" desktop = $ "#desktop"
fp = _OS.setting.desktop.path.asFileHandler() fp = _OS.setting.desktop.path.asFileHandler()
@ -262,7 +260,7 @@ self.OS.GUI =
return unless e.target is desktop[0] return unless e.target is desktop[0]
desktop[0].set "selected", -1 desktop[0].set "selected", -1
($ "#sysdock").get(0).set "selectedApp", null ($ "#sysdock").get(0).set "selectedApp", null
console.log "desktop clicked" #console.log "desktop clicked"
desktop[0].contextmenuHandler = (e, m) -> desktop[0].contextmenuHandler = (e, m) ->
desktop[0].set "selected", -1 if e.target is desktop[0] desktop[0].set "selected", -1 if e.target is desktop[0]