2017-10-08 21:45:01 +00:00
|
|
|
_G.requireInjector()
|
2017-09-05 06:09:31 +00:00
|
|
|
|
2018-01-13 20:17:26 +00:00
|
|
|
--[[
|
|
|
|
Adds the control-d hotkey to view the kernel log.
|
|
|
|
]]
|
|
|
|
|
2016-12-11 19:24:52 +00:00
|
|
|
local Terminal = require('terminal')
|
|
|
|
|
2018-01-12 01:53:32 +00:00
|
|
|
local kernel = _G.kernel
|
2018-01-10 21:46:37 +00:00
|
|
|
local keyboard = _G.device.keyboard
|
2017-10-08 21:45:01 +00:00
|
|
|
local multishell = _ENV.multishell
|
|
|
|
local os = _G.os
|
|
|
|
local term = _G.term
|
|
|
|
|
2018-01-13 20:17:26 +00:00
|
|
|
if multishell and multishell.setTitle then
|
|
|
|
multishell.setTitle(multishell.getCurrent(), 'System Log')
|
|
|
|
end
|
2016-12-11 19:24:52 +00:00
|
|
|
|
2018-01-13 20:17:26 +00:00
|
|
|
local routine = kernel.getCurrent()
|
2016-12-11 19:24:52 +00:00
|
|
|
local previousId
|
|
|
|
|
2018-01-13 20:17:26 +00:00
|
|
|
kernel.window.reposition(1, 2)
|
|
|
|
Terminal.scrollable(kernel.window, 50)
|
|
|
|
|
|
|
|
routine.terminal = kernel.window
|
|
|
|
routine.window = kernel.window
|
|
|
|
|
|
|
|
term.redirect(routine.window)
|
2016-12-11 19:24:52 +00:00
|
|
|
|
2018-01-12 01:53:32 +00:00
|
|
|
kernel.hook('mouse_scroll', function(_, eventData)
|
|
|
|
local dir, y = eventData[1], eventData[3]
|
|
|
|
|
|
|
|
if y > 1 then
|
|
|
|
local currentTab = kernel.routines[1]
|
|
|
|
if currentTab.terminal.scrollUp then
|
|
|
|
if dir == -1 then
|
|
|
|
currentTab.terminal.scrollUp()
|
|
|
|
else
|
|
|
|
currentTab.terminal.scrollDown()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
2018-01-10 21:46:37 +00:00
|
|
|
keyboard.addHotkey('control-d', function()
|
2018-01-13 20:17:26 +00:00
|
|
|
local current = kernel.getFocused()
|
|
|
|
if current.uid ~= routine.uid then
|
|
|
|
previousId = current.uid
|
|
|
|
kernel.raise(routine.uid)
|
2016-12-11 19:24:52 +00:00
|
|
|
elseif previousId then
|
2018-01-13 20:17:26 +00:00
|
|
|
kernel.raise(previousId)
|
2016-12-11 19:24:52 +00:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
|
|
|
|
os.pullEventRaw('terminate')
|
2018-01-10 21:46:37 +00:00
|
|
|
keyboard.removeHotkey('control-d')
|