mirror of
https://github.com/kepler155c/opus
synced 2025-10-22 19:27:42 +00:00
generalized canvas
This commit is contained in:
@@ -177,7 +177,7 @@ function UI.Icon:init(args)
|
||||
width = 14,
|
||||
height = 4,
|
||||
}
|
||||
UI.setProperties(defaults, args)
|
||||
UI:setProperties(defaults, args)
|
||||
UI.Window.init(self, defaults)
|
||||
end
|
||||
|
||||
@@ -327,8 +327,8 @@ function page:refresh()
|
||||
end
|
||||
|
||||
function page:resize()
|
||||
self:refresh()
|
||||
UI.Page.resize(self)
|
||||
self:refresh()
|
||||
end
|
||||
|
||||
function page:eventHandler(event)
|
||||
|
@@ -25,7 +25,8 @@ local Config = require('config')
|
||||
local Opus = require('opus')
|
||||
local Util = require('util')
|
||||
|
||||
-- Begin multishell
|
||||
local SESSION_FILE = 'usr/config/multishell.session'
|
||||
|
||||
local parentTerm = term.current()
|
||||
local w,h = parentTerm.getSize()
|
||||
local tabs = {}
|
||||
@@ -228,6 +229,7 @@ local function launchProcess(tab)
|
||||
selectTab(previousTab)
|
||||
end
|
||||
redrawMenu()
|
||||
saveSession()
|
||||
end)
|
||||
|
||||
tabs[tab.tabId] = tab
|
||||
@@ -259,6 +261,19 @@ local function resizeWindows()
|
||||
end
|
||||
end
|
||||
|
||||
local function saveSession()
|
||||
local t = { }
|
||||
for _,process in pairs(tabs) do
|
||||
if process.path and not process.isOverview and not process.hidden then
|
||||
table.insert(t, {
|
||||
path = process.path,
|
||||
args = process.args,
|
||||
})
|
||||
end
|
||||
end
|
||||
--Util.writeTable(SESSION_FILE, t)
|
||||
end
|
||||
|
||||
local control
|
||||
local hotkeys = { }
|
||||
|
||||
@@ -383,6 +398,11 @@ function multishell.openTab(tab)
|
||||
else
|
||||
redrawMenu()
|
||||
end
|
||||
|
||||
if not tab.hidden then
|
||||
saveSession()
|
||||
end
|
||||
|
||||
return tab.tabId
|
||||
end
|
||||
|
||||
@@ -454,6 +474,7 @@ end)
|
||||
|
||||
local function startup()
|
||||
local hasError
|
||||
local session = Util.readTable(SESSION_FILE)
|
||||
|
||||
local overviewId = multishell.openTab({
|
||||
path = 'sys/apps/Overview.lua',
|
||||
@@ -471,6 +492,12 @@ local function startup()
|
||||
hasError = true
|
||||
end
|
||||
|
||||
if session then
|
||||
for _,v in pairs(session) do
|
||||
multishell.openTab(v)
|
||||
end
|
||||
end
|
||||
|
||||
if hasError then
|
||||
print()
|
||||
error('An autorun program has errored')
|
||||
|
@@ -27,13 +27,17 @@ if not socket then
|
||||
error('Unable to connect to ' .. remoteId .. ' on port 5900')
|
||||
end
|
||||
|
||||
local w, h = term.getSize()
|
||||
socket:write({
|
||||
type = 'termInfo',
|
||||
width = w,
|
||||
height = h,
|
||||
isColor = term.isColor(),
|
||||
})
|
||||
local function writeTermInfo()
|
||||
local w, h = term.getSize()
|
||||
socket:write({
|
||||
type = 'termInfo',
|
||||
width = w,
|
||||
height = h,
|
||||
isColor = term.isColor(),
|
||||
})
|
||||
end
|
||||
|
||||
writeTermInfo()
|
||||
|
||||
local ct = Util.shallowCopy(term.current())
|
||||
|
||||
@@ -57,7 +61,7 @@ ct.clear()
|
||||
ct.setCursorPos(1, 1)
|
||||
|
||||
local filter = Util.transpose({
|
||||
'char', 'paste', 'key', 'key_up',
|
||||
'char', 'paste', 'key', 'key_up',
|
||||
'mouse_scroll', 'mouse_click', 'mouse_drag', 'mouse_up',
|
||||
})
|
||||
|
||||
@@ -78,6 +82,8 @@ while true do
|
||||
type = 'shellRemote',
|
||||
event = e,
|
||||
})
|
||||
elseif event == 'term_resize' then
|
||||
writeTermInfo()
|
||||
elseif event == 'terminate' then
|
||||
socket:close()
|
||||
ct.setBackgroundColor(colors.black)
|
||||
|
Reference in New Issue
Block a user