1
0
mirror of https://github.com/kepler155c/opus synced 2024-06-15 01:39:59 +00:00

better startup

This commit is contained in:
kepler155c@gmail.com 2017-09-26 01:40:02 -04:00
parent 1c3e4917da
commit 2d93974e6a
5 changed files with 48 additions and 29 deletions

View File

@ -1,6 +1,6 @@
local Opus = { } local Opus = { }
local function runDir(directory, desc, open) local function runDir(directory, open)
if not fs.exists(directory) then if not fs.exists(directory) then
return true return true
end end
@ -37,18 +37,13 @@ local function runDir(directory, desc, open)
return success return success
end end
function Opus.loadExtensions()
--return runDir('sys/extensions', '[ ext ] ', shell.run)
return true
end
function Opus.loadServices() function Opus.loadServices()
return runDir('sys/services', '[ svc ] ', shell.openHiddenTab) return runDir('sys/services', shell.openHiddenTab)
end end
function Opus.autorun() function Opus.autorun()
local s = runDir('sys/autorun', '[ aut ] ', shell.run) local s = runDir('sys/autorun', shell.run)
return runDir('usr/autorun', '[ aut ] ', shell.run) and s return runDir('usr/autorun', shell.run) and s
end end
return Opus return Opus

View File

@ -134,6 +134,7 @@ local page = UI.Page {
accelerators = { accelerators = {
r = 'refresh', r = 'refresh',
e = 'edit', e = 'edit',
f = 'files',
s = 'shell', s = 'shell',
l = 'lua', l = 'lua',
[ 'control-l' ] = 'refresh', [ 'control-l' ] = 'refresh',
@ -337,6 +338,12 @@ function page:eventHandler(event)
focused = true, focused = true,
}) })
elseif event.type == 'files' then
multishell.openTab({
path = 'sys/apps/Files.lua',
focused = true,
})
elseif event.type == 'focus_change' then elseif event.type == 'focus_change' then
if event.focused.parent.UIElement == 'Icon' then if event.focused.parent.UIElement == 'Icon' then
event.focused.parent:scrollIntoView() event.focused.parent:scrollIntoView()

View File

@ -37,23 +37,23 @@ local tabsDirty = false
local config = { local config = {
standard = { standard = {
textColor = colors.lightGray,
tabBarTextColor = colors.lightGray,
focusTextColor = colors.white, focusTextColor = colors.white,
backgroundColor = colors.gray,
tabBarBackgroundColor = colors.gray,
focusBackgroundColor = colors.gray, focusBackgroundColor = colors.gray,
textColor = colors.gray,
backgroundColor = colors.lightGray,
tabBarTextColor = colors.black,
tabBarBackgroundColor = colors.lightGray,
}, },
color = { color = {
focusTextColor = colors.white,
focusBackgroundColor = colors.black,
textColor = colors.lightGray, textColor = colors.lightGray,
backgroundColor = colors.black,
tabBarTextColor = colors.lightGray, tabBarTextColor = colors.lightGray,
tabBarBackgroundColor = colors.black, focusTextColor = colors.white,
backgroundColor = colors.gray,
tabBarBackgroundColor = colors.gray,
focusBackgroundColor = colors.gray,
}, },
-- path = '.:/apps:' .. shell.path():sub(3), -- path = '.:/apps:' .. shell.path():sub(3),
path = 'usr/apps:sys/apps:' .. shell.path(), path = shell.path(),
} }
Config.load('multishell', config) Config.load('multishell', config)
@ -463,10 +463,6 @@ end)
local function startup() local function startup()
local hasError local hasError
--if not Opus.loadExtensions() then
-- hasError = true
--end
local overviewId = multishell.openTab({ local overviewId = multishell.openTab({
path = 'sys/apps/Overview.lua', path = 'sys/apps/Overview.lua',
focused = true, focused = true,

View File

@ -1,13 +1,14 @@
local parentShell = shell local parentShell = shell
local shell = { } local shell = { }
local multishell = multishell or { }
local sandboxEnv = setmetatable({ }, { __index = _G }) local sandboxEnv = setmetatable({ }, { __index = _G })
for k,v in pairs(getfenv(1)) do for k,v in pairs(getfenv(1)) do
sandboxEnv[k] = v sandboxEnv[k] = v
end end
sandboxEnv.shell = shell sandboxEnv.shell = shell
sandboxEnv.multishell = multishell or { } sandboxEnv.multishell = multishell
requireInjector(getfenv(1)) requireInjector(getfenv(1))

View File

@ -1,17 +1,33 @@
-- Loads the Opus environment regardless if the file system is local or not -- Loads the Opus environment regardless if the file system is local or not
local w, h = term.getSize() local w, h = term.getSize()
local str = 'Opus OS' local str = 'Loading Opus...'
term.setTextColor(colors.white) term.setTextColor(colors.white)
if term.isColor() then if term.isColor() then
term.setBackgroundColor(colors.cyan) term.setBackgroundColor(colors.cyan)
else term.clear()
term.setBackgroundColor(colors.lightGray) local opus = {
'9999900',
'999907000',
'9900770b00 4444',
'99077777444444444',
'907777744444444444',
'90000777444444444',
'070000111744444',
'777770000',
'7777000000',
'70700000000',
'077000000000',
}
for k,line in ipairs(opus) do
term.setCursorPos((w - 18) / 2, k + (h - #opus) / 2)
term.blit(string.rep(' ', #line), string.rep('a', #line), line)
end
end end
term.setCursorPos((w - #str) / 2, h / 2)
term.clear() term.setCursorPos((w - #str) / 2, h)
term.write(str) term.write(str)
term.setCursorPos(1, h / 2 + 2) term.setCursorPos(w, h)
local GIT_REPO = 'kepler155c/opus/develop' local GIT_REPO = 'kepler155c/opus/develop'
local BASE = 'https://raw.githubusercontent.com/' .. GIT_REPO local BASE = 'https://raw.githubusercontent.com/' .. GIT_REPO
@ -37,6 +53,8 @@ local function run(file, ...)
end end
if not s then if not s then
-- term.setBackgroundColor(colors.black)
-- term.clear()
printError('Error loading ' .. file) printError('Error loading ' .. file)
error(m) error(m)
end end
@ -54,6 +72,8 @@ local function runUrl(file, ...)
return fn(...) return fn(...)
end end
end end
-- term.setBackgroundColor(colors.black)
-- term.clear()
error('Failed to download ' .. url) error('Failed to download ' .. url)
end end