2018-01-13 15:17:26 -05:00
|
|
|
--[[
|
2018-01-24 17:39:38 -05:00
|
|
|
Adds a task and the control-d hotkey to view the kernel log.
|
2018-01-20 07:18:13 -05:00
|
|
|
--]]
|
2016-12-11 14:24:52 -05:00
|
|
|
|
2018-01-11 20:53:32 -05:00
|
|
|
local kernel = _G.kernel
|
2018-01-10 16:46:37 -05:00
|
|
|
local keyboard = _G.device.keyboard
|
2017-10-08 17:45:01 -04:00
|
|
|
local os = _G.os
|
|
|
|
|
2018-01-24 17:39:38 -05:00
|
|
|
local function systemLog()
|
|
|
|
local routine = kernel.getCurrent()
|
|
|
|
|
|
|
|
kernel.hook('mouse_scroll', function(_, eventData)
|
|
|
|
local dir, y = eventData[1], eventData[3]
|
|
|
|
|
|
|
|
if y > 1 then
|
|
|
|
local currentTab = kernel.getFocused()
|
2019-02-05 23:03:57 -05:00
|
|
|
if currentTab == routine then
|
2020-05-08 22:32:44 -06:00
|
|
|
if currentTab.terminal.scrollUp then
|
2019-02-05 23:03:57 -05:00
|
|
|
if dir == -1 then
|
|
|
|
currentTab.terminal.scrollUp()
|
|
|
|
else
|
|
|
|
currentTab.terminal.scrollDown()
|
|
|
|
end
|
2018-01-24 17:39:38 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
keyboard.addHotkey('control-d', function()
|
|
|
|
local current = kernel.getFocused()
|
|
|
|
if current.uid ~= routine.uid then
|
|
|
|
kernel.raise(routine.uid)
|
|
|
|
elseif kernel.routines[2] then
|
|
|
|
kernel.raise(kernel.routines[2].uid)
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
os.pullEventRaw('terminate')
|
|
|
|
keyboard.removeHotkey('control-d')
|
2018-01-13 15:17:26 -05:00
|
|
|
end
|
2016-12-11 14:24:52 -05:00
|
|
|
|
2020-05-11 17:25:58 -06:00
|
|
|
kernel.run(_ENV, {
|
2019-12-07 12:04:58 -07:00
|
|
|
title = 'System Log',
|
|
|
|
fn = systemLog,
|
|
|
|
noTerminate = true,
|
|
|
|
hidden = true,
|
|
|
|
})
|