mirror of
https://github.com/kepler155c/opus
synced 2025-01-03 20:30:28 +00:00
better shell launcher
This commit is contained in:
parent
8a030cbc50
commit
9e4eb1207e
27
sys/apps/ShellLauncher.lua
Normal file
27
sys/apps/ShellLauncher.lua
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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
|
@ -17,7 +17,7 @@ local tab = UI.Tab {
|
|||||||
x = 13, y = 2, width = 12,
|
x = 13, y = 2, width = 12,
|
||||||
choices = {
|
choices = {
|
||||||
{ name = 'Overview', value = 'sys/apps/Overview.lua' },
|
{ name = 'Overview', value = 'sys/apps/Overview.lua' },
|
||||||
{ name = 'Shell', value = 'sys/apps/shell.lua' },
|
{ name = 'Shell', value = 'sys/apps/ShellLauncher.lua' },
|
||||||
{ name = 'Custom', value = 'custom' },
|
{ name = 'Custom', value = 'custom' },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user