opus/sys/boot/kiosk.lua

41 lines
994 B
Lua
Raw Normal View History

2019-01-09 13:50:42 +00:00
local os = _G.os
local parallel = _G.parallel
local peripheral = _G.peripheral
2019-01-10 07:22:06 +00:00
local settings = _G.settings
2019-01-09 13:50:42 +00:00
local term = _G.term
2019-01-20 03:05:05 +00:00
local name = settings.get('kiosk.monitor')
if not name then
peripheral.find('monitor', function(s)
name = s
end)
end
local mon = name and peripheral.wrap(name)
2019-01-18 13:48:30 +00:00
2019-01-09 13:50:42 +00:00
if mon then
2019-07-31 22:21:18 +00:00
print("Opus OS is running in Kiosk mode, and the screen will be redirected to the monitor. To undo this, go to the boot option menu by pressing a key while booting, then select the option 2.")
2019-01-09 13:50:42 +00:00
term.redirect(mon)
2019-01-11 15:01:06 +00:00
mon.setTextScale(tonumber(settings.get('kiosk.textscale')) or 1)
2019-01-09 13:50:42 +00:00
parallel.waitForAny(
function()
os.run(_ENV, '/sys/boot/opus.boot')
end,
function()
while true do
2019-01-20 03:05:05 +00:00
local event, side, x, y = os.pullEventRaw('monitor_touch')
2019-01-09 13:50:42 +00:00
2019-01-20 03:05:05 +00:00
if event == 'monitor_touch' and side == name then
2019-01-09 13:50:42 +00:00
os.queueEvent('mouse_click', 1, x, y)
os.queueEvent('mouse_up', 1, x, y)
end
end
end
)
else
os.run(_ENV, '/sys/boot/opus.boot')
end