mirror of
https://github.com/kepler155c/opus
synced 2024-11-05 00:16:16 +00:00
27 lines
683 B
Lua
27 lines
683 B
Lua
|
local kernel = _G.kernel
|
||
|
local os = _G.os
|
||
|
local shell = _ENV.shell
|
||
|
|
||
|
local launcherTab = kernel.getCurrent()
|
||
|
|
||
|
kernel.hook('kernel_focus', function(_, eventData)
|
||
|
local focusTab = eventData and eventData[1]
|
||
|
if focusTab == launcherTab.uid then
|
||
|
local previousTab = eventData[2]
|
||
|
local nextTab = launcherTab
|
||
|
if not previousTab then
|
||
|
for _, v in pairs(kernel.routines) do
|
||
|
if not v.hidden and v.uid > nextTab.uid then
|
||
|
nextTab = v
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
if nextTab == launcherTab then
|
||
|
shell.switchTab(shell.openTab('sys/apps/shell.lua'))
|
||
|
else
|
||
|
shell.switchTab(nextTab.uid)
|
||
|
end
|
||
|
end
|
||
|
end)
|
||
|
|
||
|
while os.pullEventRaw() do end
|