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,6 +188,26 @@ self.OS.GUI =
scheme = $.parseHTML x
($ "#wrapper").append scheme
_courrier.observable.one "sysdockloaded", () ->
($ window).bind 'keydown', (event) ->
dock = ($ "#sysdock")[0]
return unless dock
app = dock.get "selectedApp"
return true unless app
c = String.fromCharCode(event.which).toUpperCase()
fnk = undefined
if event.ctrlKey
fnk = "CTRL"
else if event.metaKey
fnk = "META"
else if event.shiftKey
fnk = "SHIFT"
else if event.altKey
fnk = "ALT"
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: [] }
@ -196,23 +216,6 @@ self.OS.GUI =
riot.mount ($ "#contextmenu")
($ "#workspace").contextmenu (e) -> _GUI.bindContextMenu e
($ window).bind 'keydown', (event) ->
app = ($ "#sysdock")[0].get "selectedApp"
return true unless app
c = String.fromCharCode(event.which).toUpperCase()
fnk = undefined
if event.ctrlKey
fnk = "CTRL"
else if event.metaKey
fnk = "META"
else if event.shiftKey
fnk = "SHIFT"
else if event.altKey
fnk = "ALT"
return unless fnk
r = app.shortcut fnk, c
event.preventDefault() if not r
# desktop default file manager
desktop = $ "#desktop"
fp = _OS.setting.desktop.path.asFileHandler()
@ -375,9 +378,4 @@ self.OS.GUI =
# TODO: get services list from user setting
_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"
#_GUI.launch "DummyApp"