kiosk mode

This commit is contained in:
kepler155c@gmail.com 2019-01-09 08:50:42 -05:00
parent 4977ea94d7
commit f0a65d87ce
3 changed files with 37 additions and 2 deletions

View File

@ -7,6 +7,7 @@ local bootOptions = {
{ prompt = os.version() },
{ prompt = 'Opus' , args = { '/sys/boot/opus.boot' } },
{ prompt = 'Opus Shell' , args = { '/sys/boot/opus.boot', 'sys/apps/shell' } },
{ prompt = 'Opus Kiosk' , args = { '/sys/boot/kiosk.boot' } },
}
local bootOption = 2
if settings then

View File

@ -97,10 +97,10 @@ function Manager:init()
end,
monitor_touch = function(_, side, x, y)
Input:translate('mouse_click', 1, x, y)
local ie = Input:translate('mouse_up', 1, x, y)
local dev = self.devices[side]
if dev and dev.currentPage then
Input:translate('mouse_click', 1, x, y)
local ie = Input:translate('mouse_up', 1, x, y)
self:click(dev.currentPage, ie.code, 1, x, y)
end
end,

34
sys/boot/kiosk.boot Normal file
View File

@ -0,0 +1,34 @@
local os = _G.os
local parallel = _G.parallel
local peripheral = _G.peripheral
local settings = _G.settings
local term = _G.term
local mon = peripheral.find('monitor')
if mon then
term.redirect(mon)
if not settings.get('opus.kiosk.textscale') then
settings.set('opus.kiosk.textscale', .5)
end
mon.setTextScale(settings.get('opus.kiosk.textscale') or .5)
parallel.waitForAny(
function()
os.run(_ENV, '/sys/boot/opus.boot')
end,
function()
while true do
local event, _, x, y = os.pullEventRaw('monitor_touch')
if event == 'monitor_touch' then
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