diff --git a/startup b/startup index 917ddab..a6631fb 100644 --- a/startup +++ b/startup @@ -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 diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index 09ef448..13b7187 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -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, diff --git a/sys/boot/kiosk.boot b/sys/boot/kiosk.boot new file mode 100644 index 0000000..ad4da1a --- /dev/null +++ b/sys/boot/kiosk.boot @@ -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