fix startup

This commit is contained in:
Xuan Sang LE 2018-02-28 17:18:00 +01:00
parent 7d7df62158
commit 9de4e5ff5f
3 changed files with 23 additions and 24 deletions

View File

@ -4,5 +4,4 @@ _PM = self.OS.PM
_OS = self.OS
_courrier = self.OS.courrier
this.onload = () ->
console.log "Booting the os"
self.OS.boot()

View File

@ -91,6 +91,7 @@ self.OS or=
a.quit() for a in tmp
cleanup: ->
console.log "Clean up system"
($ "#wrapper").empty()
_GUI.clearTheme()
_courrier.observable = riot.observable()
@ -108,6 +109,7 @@ self.OS or=
boot: ->
#first login
console.log "Booting sytem"
_API.handler.auth (d) ->
# in case someone call it more than once :)
if d.error

View File

@ -188,16 +188,11 @@ self.OS.GUI =
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
_courrier.observable.one "sysdockloaded", () ->
($ window).bind 'keydown', (event) ->
app = ($ "#sysdock")[0].get "selectedApp"
dock = ($ "#sysdock")[0]
return unless dock
app = dock.get "selectedApp"
return true unless app
c = String.fromCharCode(event.which).toUpperCase()
fnk = undefined
@ -213,6 +208,14 @@ self.OS.GUI =
return unless fnk
r = app.shortcut fnk, c
event.preventDefault() if not r
# 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 = $ "#desktop"
fp = _OS.setting.desktop.path.asFileHandler()
@ -376,8 +379,3 @@ self.OS.GUI =
_GUI.pushServices (v for v in _OS.setting.system.startup.services)
(_GUI.launch a) for a in _OS.setting.system.startup.apps
#_GUI.launch "DummyApp"
# startup application here
_courrier.observable.one "desktoploaded", () ->
#_GUI.launch "DummyApp"
#_GUI.launch "NotePad"