2019-11-10 22:58:36 +00:00
|
|
|
local Alt = require('opus.alternate')
|
|
|
|
|
2019-04-23 18:48:39 +00:00
|
|
|
local kernel = _G.kernel
|
|
|
|
local os = _G.os
|
|
|
|
local shell = _ENV.shell
|
|
|
|
|
|
|
|
local launcherTab = kernel.getCurrent()
|
2019-11-10 22:58:36 +00:00
|
|
|
launcherTab.noFocus = true
|
2019-04-23 18:48:39 +00:00
|
|
|
|
|
|
|
kernel.hook('kernel_focus', function(_, eventData)
|
2019-06-18 19:19:24 +00:00
|
|
|
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
|
2019-11-10 22:58:36 +00:00
|
|
|
shell.switchTab(shell.openTab(Alt.get('shell')))
|
2019-06-18 19:19:24 +00:00
|
|
|
else
|
|
|
|
shell.switchTab(nextTab.uid)
|
|
|
|
end
|
|
|
|
end
|
2019-04-23 18:48:39 +00:00
|
|
|
end)
|
|
|
|
|
2020-03-30 06:07:20 +00:00
|
|
|
os.pullEventRaw('kernel_halt')
|