mirror of
https://github.com/LDDestroier/CC/
synced 2025-08-04 21:03:49 +00:00
Fixed swapped workspaces, added new void
This commit is contained in:
parent
e8a7f9104a
commit
7ebd4524f5
296
workspace.lua
296
workspace.lua
@ -10,6 +10,11 @@ local config = {
|
|||||||
workspaceMoveSpeed = 0.1,
|
workspaceMoveSpeed = 0.1,
|
||||||
defaultProgram = "rom/programs/shell.lua",
|
defaultProgram = "rom/programs/shell.lua",
|
||||||
timesRan = 0,
|
timesRan = 0,
|
||||||
|
useDefaultProgramWhenStarting = true,
|
||||||
|
doPauseClockAndTime = true,
|
||||||
|
skipAcrossEmptyWorkspaces = true,
|
||||||
|
showInactiveFrame = true,
|
||||||
|
doTrippyVoid = true,
|
||||||
WSmap = {
|
WSmap = {
|
||||||
{true,true,true},
|
{true,true,true},
|
||||||
{true,true,true},
|
{true,true,true},
|
||||||
@ -109,6 +114,7 @@ lddterm.adjustX = 0 -- moves entire screen X
|
|||||||
lddterm.adjustY = 0 -- moves entire screen Y
|
lddterm.adjustY = 0 -- moves entire screen Y
|
||||||
lddterm.selectedWindow = 1 -- determines which window controls the cursor
|
lddterm.selectedWindow = 1 -- determines which window controls the cursor
|
||||||
lddterm.windows = {} -- internal list of all lddterm windows
|
lddterm.windows = {} -- internal list of all lddterm windows
|
||||||
|
lddterm.backdropColors = {"0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}
|
||||||
|
|
||||||
-- draws one of three things:
|
-- draws one of three things:
|
||||||
-- 1. workspace grid indicator
|
-- 1. workspace grid indicator
|
||||||
@ -605,9 +611,16 @@ lddterm.screenshot = function(window)
|
|||||||
line = {"","",""}
|
line = {"","",""}
|
||||||
for x = 1, scr_x do
|
for x = 1, scr_x do
|
||||||
|
|
||||||
c = " "
|
|
||||||
lt, lb = t, b
|
lt, lb = t, b
|
||||||
t, b = "0", "f"
|
if config.doTrippyVoid then
|
||||||
|
c = string.char(math.random(128, 159))
|
||||||
|
t = lddterm.backdropColors[1 + math.floor((y - realScroll[2] * scr_y) % #lddterm.backdropColors)]
|
||||||
|
b = lddterm.backdropColors[1 + math.floor((x - realScroll[1] * scr_x) % #lddterm.backdropColors)]
|
||||||
|
else
|
||||||
|
c = string.char( math.max(128, math.random(-5000, 159)) )
|
||||||
|
t = ({"7", "8"})[math.random(1, 2)]
|
||||||
|
b = "f"
|
||||||
|
end
|
||||||
for l, v in pairs(lddterm.windows) do
|
for l, v in pairs(lddterm.windows) do
|
||||||
if lddterm.windows[l] then
|
if lddterm.windows[l] then
|
||||||
if lddterm.windows[l].visible then
|
if lddterm.windows[l].visible then
|
||||||
@ -654,19 +667,72 @@ local newInstance = function(x, y, program, initialStart)
|
|||||||
instances[y][xx] = instances[y][xx] or false
|
instances[y][xx] = instances[y][xx] or false
|
||||||
end
|
end
|
||||||
local window = lddterm.newWindow(windowWidth, windowHeight, 1, 1)
|
local window = lddterm.newWindow(windowWidth, windowHeight, 1, 1)
|
||||||
|
|
||||||
|
local instance = {
|
||||||
|
x = x,
|
||||||
|
y = y,
|
||||||
|
active = initialStart,
|
||||||
|
program = program or config.defaultProgram,
|
||||||
|
window = window,
|
||||||
|
timer = {},
|
||||||
|
clockMod = 0,
|
||||||
|
lastClock = 0,
|
||||||
|
timeMod = 0,
|
||||||
|
lastTime = 0,
|
||||||
|
extraEvents = {},
|
||||||
|
paused = false
|
||||||
|
}
|
||||||
|
|
||||||
local func = function()
|
local func = function()
|
||||||
term.redirect(window.handle)
|
term.redirect(window.handle)
|
||||||
|
|
||||||
local runProgram = function()
|
local runProgram = function()
|
||||||
instances[y][x].paused = false
|
instance.paused = false
|
||||||
if not instances[y][x].program or type(instances[y][x].program) == "string" then
|
term.setCursorBlink(false)
|
||||||
pcall(loadfile(instances[y][x].program, nil, nil, instances[y][x].env))
|
if not instance.program or type(instance.program) == "string" then
|
||||||
elseif type(instances[y][x].program) == "function" then
|
--pcall(loadfile(instances[y][x].program, nil, nil, instance.env))
|
||||||
pcall(function() load(instances[y][x].program, nil, nil, instances[y][x].env) end)
|
--load(function() pcall(function() shell.run(instance.program) end) end, nil, nil, instance.env)
|
||||||
|
pcall(shell.run, instance.program)
|
||||||
|
elseif type(instance.program) == "function" then
|
||||||
|
pcall(function() load(instance.program, nil, nil, instance.env) end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local drawInactiveScreen = function()
|
||||||
|
term.setTextColor(colors.white)
|
||||||
|
term.setBackgroundColor(colors.black)
|
||||||
|
term.clear()
|
||||||
|
term.setCursorBlink(false)
|
||||||
|
|
||||||
|
if config.showInactiveFrame then
|
||||||
|
if (instance.y + instance.x) % 2 == 0 then
|
||||||
|
term.setTextColor(colors.lightGray)
|
||||||
|
else
|
||||||
|
term.setTextColor(colors.gray)
|
||||||
|
end
|
||||||
|
for y = 1, scr_y do
|
||||||
|
for x = 1, scr_x do
|
||||||
|
if y == 1 or y == scr_y then
|
||||||
|
if x <= 3 or x > scr_x - 3 then
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
term.write("\127")
|
||||||
|
end
|
||||||
|
elseif y <= 3 or y > scr_y - 3 then
|
||||||
|
if x == 1 or x == scr_x then
|
||||||
|
term.setCursorPos(x, y)
|
||||||
|
term.write("\127")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
term.setTextColor(colors.white)
|
||||||
|
end
|
||||||
|
|
||||||
|
cwrite("This workspace is inactive.", 0 + scr_y / 2)
|
||||||
|
cwrite("Press SPACE to start the workspace.", 1 + scr_y / 2)
|
||||||
|
cwrite("(" .. tostring(instance.x) .. ", " .. tostring(instance.y) .. ")", 3 + scr_y / 2)
|
||||||
|
end
|
||||||
|
|
||||||
local evt
|
local evt
|
||||||
while true do
|
while true do
|
||||||
|
|
||||||
@ -674,19 +740,21 @@ local newInstance = function(x, y, program, initialStart)
|
|||||||
runProgram()
|
runProgram()
|
||||||
end
|
end
|
||||||
|
|
||||||
instances[y][x].active = false
|
instance.active = false
|
||||||
instances[y][x].paused = false
|
instance.paused = false
|
||||||
instances[y][x].program = config.defaultProgram
|
if config.useDefaultProgramWhenStarting then
|
||||||
|
instance.program = config.defaultProgram
|
||||||
|
end
|
||||||
|
|
||||||
term.clear()
|
drawInactiveScreen()
|
||||||
term.setCursorBlink(false)
|
|
||||||
cwrite("This workspace is inactive.", 0 + scr_y / 2)
|
|
||||||
cwrite("Press SPACE to start the workspace.", 1 + scr_y / 2)
|
|
||||||
|
|
||||||
coroutine.yield()
|
coroutine.yield()
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
evt = {os.pullEventRaw()}
|
evt = {os.pullEventRaw()}
|
||||||
|
if evt[1] == "workspace_swap" then
|
||||||
|
drawInactiveScreen()
|
||||||
|
end
|
||||||
until (evt[1] == "key" and evt[2] == keys.space) or evt[1] == "terminate"
|
until (evt[1] == "key" and evt[2] == keys.space) or evt[1] == "terminate"
|
||||||
sleep(0)
|
sleep(0)
|
||||||
if evt[1] == "terminate" then
|
if evt[1] == "terminate" then
|
||||||
@ -698,7 +766,7 @@ local newInstance = function(x, y, program, initialStart)
|
|||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorBlink(true)
|
term.setCursorBlink(true)
|
||||||
|
|
||||||
instances[y][x].active = true
|
instance.active = true
|
||||||
|
|
||||||
if not initialStart then
|
if not initialStart then
|
||||||
runProgram()
|
runProgram()
|
||||||
@ -707,18 +775,7 @@ local newInstance = function(x, y, program, initialStart)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
instances[y][x] = {
|
instances[y][x] = instance
|
||||||
x = x,
|
|
||||||
y = y,
|
|
||||||
active = initialStart,
|
|
||||||
program = program or config.defaultProgram,
|
|
||||||
window = window,
|
|
||||||
timer = {},
|
|
||||||
clockMod = 0,
|
|
||||||
lastClock = 0,
|
|
||||||
extraEvents = {},
|
|
||||||
paused = false
|
|
||||||
}
|
|
||||||
|
|
||||||
instances[y][x].env = {}
|
instances[y][x].env = {}
|
||||||
setmetatable(instances[y][x].env, {__index = _ENV})
|
setmetatable(instances[y][x].env, {__index = _ENV})
|
||||||
@ -769,8 +826,8 @@ local scrollWindows = function(doScrollWindows, tickDownTimers)
|
|||||||
for x = gridMinX, gridWidth do
|
for x = gridMinX, gridWidth do
|
||||||
if instances[y][x] then
|
if instances[y][x] then
|
||||||
|
|
||||||
instances[y][x].window.x = math.floor(1 + (instances[y][x].x + realScroll[1] - 1) * scr_x)
|
instances[y][x].window.x = math.floor(1 + (x + realScroll[1] - 1) * scr_x)
|
||||||
instances[y][x].window.y = math.floor(1 + (instances[y][x].y + realScroll[2] - 1) * scr_y)
|
instances[y][x].window.y = math.floor(1 + (y + realScroll[2] - 1) * scr_y)
|
||||||
if not instances[y][x].paused then
|
if not instances[y][x].paused then
|
||||||
tickDownInstanceTimers(x, y)
|
tickDownInstanceTimers(x, y)
|
||||||
end
|
end
|
||||||
@ -783,10 +840,14 @@ local scrollWindows = function(doScrollWindows, tickDownTimers)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local swapInstances = function(xmod, ymod)
|
local swapInstances = function(xmod, ymod)
|
||||||
for k,v in pairs(instances[focus[2]][focus[1]]) do
|
instances[focus[2]][focus[1]], instances[focus[2] + ymod][focus[1] + xmod] = instances[focus[2] + ymod][focus[1] + xmod], instances[focus[2]][focus[1]]
|
||||||
if k ~= "x" and k ~= "y" then
|
instances[focus[2]][focus[1]].x, instances[focus[2] + ymod][focus[1] + xmod].x = instances[focus[2] + ymod][focus[1] + xmod].x, instances[focus[2]][focus[1]].x
|
||||||
instances[focus[2]][focus[1]][k], instances[focus[2] + ymod][focus[1] + xmod][k] = instances[focus[2] + ymod][focus[1] + xmod][k], instances[focus[2]][focus[1]][k]
|
instances[focus[2]][focus[1]].y, instances[focus[2] + ymod][focus[1] + xmod].y = instances[focus[2] + ymod][focus[1] + xmod].y, instances[focus[2]][focus[1]].y
|
||||||
end
|
if not instances[focus[2]][focus[1]].active then
|
||||||
|
table.insert(instances[focus[2]][focus[1]].extraEvents, {"workspace_swap"})
|
||||||
|
end
|
||||||
|
if not instances[focus[2] + ymod][focus[1] + xmod].active then
|
||||||
|
table.insert(instances[focus[2] + ymod][focus[1] + xmod].extraEvents, {"workspace_swap"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -797,29 +858,34 @@ local addWorkspace = function(xmod, ymod)
|
|||||||
newInstance(focus[1] + xmod, focus[2] + ymod, config.defaultProgram, false)
|
newInstance(focus[1] + xmod, focus[2] + ymod, config.defaultProgram, false)
|
||||||
saveConfig()
|
saveConfig()
|
||||||
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
||||||
else
|
|
||||||
-- print("There's already a workspace there.")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local removeWorkspace = function(xmod, ymod)
|
local removeWorkspace = function(xmod, ymod)
|
||||||
if config.WSmap[focus[2] + ymod][focus[1] + xmod] then
|
if config.WSmap[focus[2] + ymod][focus[1] + xmod] then
|
||||||
local good = false
|
local good = false
|
||||||
for y = -1, 1 do
|
|
||||||
for x = -1, 1 do
|
for m = 1, math.max(gridHeight, gridWidth) do
|
||||||
if math.abs(x) + math.abs(y) == 1 then
|
for y = -1, 1 do
|
||||||
if instances[focus[2] + y] then
|
for x = -1, 1 do
|
||||||
if instances[focus[2] + y][focus[1] + x] then
|
if math.abs(x) + math.abs(y) == 1 then
|
||||||
good = true
|
if instances[focus[2] + y * m] then
|
||||||
break
|
if instances[focus[2] + y * m][focus[1] + x * m] then
|
||||||
|
good = true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if good then
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if good then
|
if good then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if good then
|
if good then
|
||||||
lddterm.windows[instances[focus[2] + ymod][focus[1] + xmod].window.layer] = nil
|
lddterm.windows[instances[focus[2] + ymod][focus[1] + xmod].window.layer] = nil
|
||||||
config.WSmap[focus[2] + ymod][focus[1] + xmod] = nil
|
config.WSmap[focus[2] + ymod][focus[1] + xmod] = nil
|
||||||
@ -884,7 +950,8 @@ local checkIfCanRun = function(evt, x, y)
|
|||||||
x == focus[1] and
|
x == focus[1] and
|
||||||
y == focus[2]
|
y == focus[2]
|
||||||
) or
|
) or
|
||||||
evt[1] == "terminate"
|
evt[1] == "terminate" or
|
||||||
|
evt[1] == "workspace_swap"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -899,16 +966,31 @@ local main = function()
|
|||||||
|
|
||||||
for y, v in pairs(config.WSmap) do
|
for y, v in pairs(config.WSmap) do
|
||||||
for x, vv in pairs(v) do
|
for x, vv in pairs(v) do
|
||||||
pCounter = pCounter + 1
|
|
||||||
if vv then
|
if vv then
|
||||||
if not focus[1] then
|
pCounter = pCounter + 1
|
||||||
focus = {x, y}
|
program = (argList[pCounter] and fs.exists(argList[pCounter])) and argList[pCounter]
|
||||||
|
if not program then
|
||||||
|
program = (argList[pCounter] and fs.exists(argList[pCounter] .. ".lua")) and (argList[pCounter] .. ".lua")
|
||||||
end
|
end
|
||||||
program = (argList[pCounter] and fs.exists(argList[pCounter])) and argList[pCounter] or config.defaultProgram
|
newInstance(
|
||||||
newInstance(x, y, program, x == focus[1] and y == focus[2])
|
x, y,
|
||||||
|
program or config.defaultProgram,
|
||||||
|
program and true or (pCounter == 1)
|
||||||
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
||||||
|
focus[2] = gridMinY
|
||||||
|
for x = gridMinX, gridWidth do
|
||||||
|
if instances[focus[2]][x] then
|
||||||
|
focus[1] = x
|
||||||
|
realScroll = {-x + 1, -gridMinY + 1}
|
||||||
|
scroll = {-x + 1, -gridMinY + 1}
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
scrollWindows(true, false)
|
scrollWindows(true, false)
|
||||||
|
|
||||||
@ -948,8 +1030,13 @@ local main = function()
|
|||||||
error("bad argument #1 (number expected, got " .. type(id) .. ")", 2)
|
error("bad argument #1 (number expected, got " .. type(id) .. ")", 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
os.clock = function()
|
if config.doPauseClockAndTime then
|
||||||
return oldOSreplace.clock() + instances[y][x].clockMod
|
os.clock = function()
|
||||||
|
return oldOSreplace.clock() + instances[y][x].clockMod
|
||||||
|
end
|
||||||
|
os.time = function()
|
||||||
|
return oldOSreplace.time() + instances[y][x].timeMod
|
||||||
|
end
|
||||||
end
|
end
|
||||||
os.queueEvent = function(evt, ...)
|
os.queueEvent = function(evt, ...)
|
||||||
if type(evt) == "string" then
|
if type(evt) == "string" then
|
||||||
@ -1004,10 +1091,14 @@ local main = function()
|
|||||||
enteringCommand = true
|
enteringCommand = true
|
||||||
doDrawWorkspaceIndicator = instances[focus[2]][focus[1]].paused and 2 or 3
|
doDrawWorkspaceIndicator = instances[focus[2]][focus[1]].paused and 2 or 3
|
||||||
wID = os.startTimer(workspaceIndicatorDuration)
|
wID = os.startTimer(workspaceIndicatorDuration)
|
||||||
if instances[focus[2]][focus[1]].paused then
|
if config.doPauseClockAndTime then
|
||||||
instances[focus[2]][focus[1]].lastClock = os.clock() + instances[focus[2]][focus[1]].clockMod
|
if instances[focus[2]][focus[1]].paused then
|
||||||
else
|
instances[focus[2]][focus[1]].lastClock = os.clock() + instances[focus[2]][focus[1]].clockMod
|
||||||
instances[focus[2]][focus[1]].clockMod = instances[focus[2]][focus[1]].lastClock - os.clock()
|
instances[focus[2]][focus[1]].lastTime = os.time() + instances[focus[2]][focus[1]].timeMod
|
||||||
|
else
|
||||||
|
instances[focus[2]][focus[1]].clockMod = instances[focus[2]][focus[1]].lastClock - os.clock()
|
||||||
|
instances[focus[2]][focus[1]].timeMod = instances[focus[2]][focus[1]].lastTime - os.time()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1016,9 +1107,14 @@ local main = function()
|
|||||||
if keysDown[swapKey] then
|
if keysDown[swapKey] then
|
||||||
swapInstances(-1, 0)
|
swapInstances(-1, 0)
|
||||||
end
|
end
|
||||||
focus[1] = focus[1] - 1
|
end
|
||||||
scroll[1] = scroll[1] + 1
|
for i = 1, (keysDown[swapKey] or not config.skipAcrossEmptyWorkspaces) and 1 or (focus[1] - gridMinX + 1) do
|
||||||
keysDown[keys.left] = false
|
if instances[focus[2]][focus[1] - i] then
|
||||||
|
focus[1] = focus[1] - i
|
||||||
|
scroll[1] = scroll[1] + i
|
||||||
|
keysDown[keys.left] = false
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
doDrawWorkspaceIndicator = 1
|
doDrawWorkspaceIndicator = 1
|
||||||
wID = os.startTimer(workspaceIndicatorDuration)
|
wID = os.startTimer(workspaceIndicatorDuration)
|
||||||
@ -1029,9 +1125,14 @@ local main = function()
|
|||||||
if keysDown[swapKey] then
|
if keysDown[swapKey] then
|
||||||
swapInstances(1, 0)
|
swapInstances(1, 0)
|
||||||
end
|
end
|
||||||
focus[1] = focus[1] + 1
|
end
|
||||||
scroll[1] = scroll[1] - 1
|
for i = 1, (keysDown[swapKey] or not config.skipAcrossEmptyWorkspaces) and 1 or (gridWidth - focus[1]) do
|
||||||
keysDown[keys.right] = false
|
if instances[focus[2]][focus[1] + i] then
|
||||||
|
focus[1] = focus[1] + i
|
||||||
|
scroll[1] = scroll[1] - i
|
||||||
|
keysDown[keys.right] = false
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
doDrawWorkspaceIndicator = 1
|
doDrawWorkspaceIndicator = 1
|
||||||
wID = os.startTimer(workspaceIndicatorDuration)
|
wID = os.startTimer(workspaceIndicatorDuration)
|
||||||
@ -1043,9 +1144,16 @@ local main = function()
|
|||||||
if keysDown[swapKey] then
|
if keysDown[swapKey] then
|
||||||
swapInstances(0, -1)
|
swapInstances(0, -1)
|
||||||
end
|
end
|
||||||
focus[2] = focus[2] - 1
|
end
|
||||||
scroll[2] = scroll[2] + 1
|
end
|
||||||
keysDown[keys.up] = false
|
for i = 1, (keysDown[swapKey] or not config.skipAcrossEmptyWorkspaces) and 1 or (focus[2] - gridMinY + 1) do
|
||||||
|
if instances[focus[2] - i] then
|
||||||
|
if instances[focus[2] - i][focus[1]] then
|
||||||
|
focus[2] = focus[2] - i
|
||||||
|
scroll[2] = scroll[2] + i
|
||||||
|
keysDown[keys.up] = false
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
doDrawWorkspaceIndicator = 1
|
doDrawWorkspaceIndicator = 1
|
||||||
@ -1058,9 +1166,16 @@ local main = function()
|
|||||||
if keysDown[swapKey] then
|
if keysDown[swapKey] then
|
||||||
swapInstances(0, 1)
|
swapInstances(0, 1)
|
||||||
end
|
end
|
||||||
focus[2] = focus[2] + 1
|
end
|
||||||
scroll[2] = scroll[2] - 1
|
end
|
||||||
keysDown[keys.down] = false
|
for i = 1, (keysDown[swapKey] or not config.skipAcrossEmptyWorkspaces) and 1 or (gridHeight - focus[2]) do
|
||||||
|
if instances[focus[2] + i] then
|
||||||
|
if instances[focus[2] + i][focus[1]] then
|
||||||
|
focus[2] = focus[2] + i
|
||||||
|
scroll[2] = scroll[2] - i
|
||||||
|
keysDown[keys.down] = false
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
doDrawWorkspaceIndicator = 1
|
doDrawWorkspaceIndicator = 1
|
||||||
@ -1096,29 +1211,34 @@ local main = function()
|
|||||||
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
gridWidth, gridHeight, gridMinX, gridMinY = getMapSize()
|
||||||
end
|
end
|
||||||
if keysDown[keys.q] then
|
if keysDown[keys.q] then
|
||||||
removeWorkspace(0, 0)
|
|
||||||
doDrawWorkspaceIndicator = 1
|
doDrawWorkspaceIndicator = 1
|
||||||
wID = os.startTimer(workspaceIndicatorDuration)
|
wID = os.startTimer(workspaceIndicatorDuration)
|
||||||
keysDown[keys.q] = false
|
keysDown[keys.q] = false
|
||||||
local good = false
|
local good = false
|
||||||
for y = -1, 1 do
|
for m = 1, math.max(gridHeight, gridWidth) do
|
||||||
for x = -1, 1 do
|
for y = -1, 1 do
|
||||||
if math.abs(x) + math.abs(y) == 1 then
|
for x = -1, 1 do
|
||||||
if instances[focus[2] + y] then
|
if math.abs(x) + math.abs(y) == 1 then
|
||||||
if instances[focus[2] + y][focus[1] + x] then
|
if instances[focus[2] + y * m] then
|
||||||
focus = {
|
if instances[focus[2] + y * m][focus[1] + x * m] then
|
||||||
focus[1] + x,
|
removeWorkspace(0, 0)
|
||||||
focus[2] + y
|
focus = {
|
||||||
}
|
focus[1] + x * m,
|
||||||
scroll = {
|
focus[2] + y * m
|
||||||
scroll[1] - x,
|
}
|
||||||
scroll[2] - y
|
scroll = {
|
||||||
}
|
scroll[1] - x * m,
|
||||||
good = true
|
scroll[2] - y * m
|
||||||
break
|
}
|
||||||
|
good = true
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if good then
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if good then
|
if good then
|
||||||
break
|
break
|
||||||
@ -1132,7 +1252,10 @@ local main = function()
|
|||||||
|
|
||||||
oldOSreplace.startTimer = os.startTimer
|
oldOSreplace.startTimer = os.startTimer
|
||||||
oldOSreplace.cancelTimer = os.cancelTimer
|
oldOSreplace.cancelTimer = os.cancelTimer
|
||||||
oldOSreplace.clock = os.clock
|
if config.doPauseClockAndTime then
|
||||||
|
oldOSreplace.clock = os.clock
|
||||||
|
oldOSreplace.time = os.time
|
||||||
|
end
|
||||||
oldOSreplace.queueEvent = os.queueEvent
|
oldOSreplace.queueEvent = os.queueEvent
|
||||||
|
|
||||||
for y = gridMinY, gridHeight do
|
for y = gridMinY, gridHeight do
|
||||||
@ -1168,7 +1291,10 @@ local main = function()
|
|||||||
|
|
||||||
os.startTimer = oldOSreplace.startTimer
|
os.startTimer = oldOSreplace.startTimer
|
||||||
os.cancelTimer = oldOSreplace.cancelTimer
|
os.cancelTimer = oldOSreplace.cancelTimer
|
||||||
os.clock = oldOSreplace.clock
|
if config.doPauseClockAndTime then
|
||||||
|
os.clock = oldOSreplace.clock
|
||||||
|
os.time = oldOSreplace.time
|
||||||
|
end
|
||||||
os.queueEvent = oldOSreplace.queueEvent
|
os.queueEvent = oldOSreplace.queueEvent
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user