mirror of
https://github.com/kepler155c/opus
synced 2025-10-22 19:27:42 +00:00
transition to kernel
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
_G.requireInjector()
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Config = require('config')
|
||||
local Event = require('event')
|
||||
|
@@ -1,5 +1,4 @@
|
||||
local injector = _G.requireInjector or load(_G.http.get('https://raw.githubusercontent.com/kepler155c/opus/master/sys/apis/injector.lua').readAll())()
|
||||
injector()
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Event = require('event')
|
||||
local History = require('history')
|
||||
@@ -13,7 +12,7 @@ local textutils = _G.textutils
|
||||
local sandboxEnv = setmetatable(Util.shallowCopy(_ENV), { __index = _G })
|
||||
sandboxEnv.exit = function() Event.exitPullEvents() end
|
||||
sandboxEnv._echo = function( ... ) return { ... } end
|
||||
injector(sandboxEnv)
|
||||
_G.requireInjector(sandboxEnv)
|
||||
|
||||
UI:configure('Lua', ...)
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
_G.requireInjector()
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Event = require('event')
|
||||
local Socket = require('socket')
|
||||
|
@@ -10,12 +10,17 @@ local Tween = require('ui.tween')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
|
||||
local colors = _G.colors
|
||||
local fs = _G.fs
|
||||
local multishell = _ENV.multishell or error('This program requires multishell')
|
||||
local pocket = _G.pocket
|
||||
local shell = _ENV.shell
|
||||
local term = _G.term
|
||||
local turtle = _G.turtle
|
||||
|
||||
if not _ENV.multishell then
|
||||
error('multishell is required')
|
||||
end
|
||||
|
||||
local REGISTRY_DIR = 'usr/.registry'
|
||||
|
||||
UI:configure('Overview', ...)
|
||||
@@ -350,32 +355,16 @@ function page:eventHandler(event)
|
||||
table.remove(config.Recent, maxRecent + 1)
|
||||
end
|
||||
Config.update('Overview', config)
|
||||
multishell.openTab({
|
||||
title = event.button.app.title,
|
||||
path = 'sys/apps/shell',
|
||||
args = { event.button.app.run },
|
||||
focused = true,
|
||||
})
|
||||
shell.switchTab(shell.openTab(event.button.app.run))
|
||||
|
||||
elseif event.type == 'shell' then
|
||||
multishell.openTab({
|
||||
path = 'sys/apps/shell',
|
||||
focused = true,
|
||||
})
|
||||
shell.switchTab(shell.openTab('sys/apps/shell'))
|
||||
|
||||
elseif event.type == 'lua' then
|
||||
multishell.openTab({
|
||||
path ='sys/apps/shell',
|
||||
args = { 'sys/apps/Lua.lua' },
|
||||
focused = true,
|
||||
})
|
||||
shell.switchTab(shell.openTab('sys/apps/Lua.lua'))
|
||||
|
||||
elseif event.type == 'files' then
|
||||
multishell.openTab({
|
||||
path ='sys/apps/shell',
|
||||
args = { 'sys/apps/Files.lua' },
|
||||
focused = true,
|
||||
})
|
||||
shell.switchTab(shell.openTab('sys/apps/Files.lua'))
|
||||
|
||||
elseif event.type == 'focus_change' then
|
||||
if event.focused.parent.UIElement == 'Icon' then
|
||||
|
@@ -1,4 +1,4 @@
|
||||
_G.requireInjector()
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Event = require('event')
|
||||
local UI = require('ui')
|
||||
|
@@ -304,7 +304,7 @@ function shell.newTab(tabInfo, ...)
|
||||
|
||||
if path then
|
||||
tabInfo.path = path
|
||||
tabInfo.env = sandboxEnv
|
||||
tabInfo.env = Util.shallowCopy(sandboxEnv)
|
||||
tabInfo.args = args
|
||||
tabInfo.title = fs.getName(path):match('([^%.]+)')
|
||||
|
||||
@@ -319,7 +319,18 @@ end
|
||||
|
||||
function shell.openTab( ... )
|
||||
-- needs to use multishell.launch .. so we can run with stock multishell
|
||||
return shell.newTab({ }, ...)
|
||||
local tWords = tokenise( ... )
|
||||
local sCommand = tWords[1]
|
||||
if sCommand then
|
||||
local sPath = shell.resolveProgram(sCommand)
|
||||
if sPath == "sys/apps/shell" then
|
||||
return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), sPath, table.unpack(tWords, 2))
|
||||
elseif sPath ~= nil then
|
||||
return _ENV.multishell.launch(Util.shallowCopy(sandboxEnv), "sys/apps/shell", sCommand, table.unpack(tWords, 2))
|
||||
else
|
||||
_G.printError( "No such program" )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function shell.openForegroundTab( ... )
|
||||
|
Reference in New Issue
Block a user