Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local scr_x,scr_y = term.getSize()
- ws = {
- window.create(term.current(),1,1,scr_x,scr_y,true),
- window.create(term.current(),1,1,scr_x,scr_y,false),
- window.create(term.current(),1,1,scr_x,scr_y,false),
- window.create(term.current(),1,1,scr_x,scr_y,false),
- }
- cws = 1
- wslength = 2
- swkey = keys.f1
- local redrawCurrentWorkspace = function()
- while true do
- for a = 1, #ws do
- ws[a].setVisible(a==cws)
- end
- -- ws[cws].redraw()
- sleep(0)
- end
- end
- term.redirect(ws[cws])
- local getInput = function()
- local isDown = false
- while true do
- local evt = {os.pullEvent()}
- local didSwitch = false
- if evt[1] == "key" then
- if evt[2] == swkey then
- isDown = true
- end
- if isDown then
- if evt[2] == keys.left then
- if ws[cws-1] then
- didSwitch = true
- cws = cws - 1
- end
- elseif evt[2] == keys.right then
- if ws[cws+1] then
- didSwitch = true
- cws = cws + 1
- end
- elseif evt[2] == keys.up then
- if ws[cws-wslength] then
- didSwitch = true
- cws = cws - wslength
- end
- elseif evt[2] == keys.down then
- if ws[cws+wslength] then
- didSwitch = true
- cws = cws + wslength
- end
- end
- end
- if didSwitch then
- term.redirect(ws[cws])
- term.clear()
- end
- elseif evt[1] == "key_up" then
- if evt[2] == swkey then
- isDown = false
- end
- end
- end
- end
- run = function()
- local output = {}
- for a = 1, #ws do
- local f = function()
- os.run(ws[a],"rom/programs/shell")
- end
- table.insert(output,f)
- end
- return output
- end
- parallel.waitForAny(getInput, redrawCurrentWorkspace, table.unpack(run()))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement