-- factoryos.programs.console — maintenance console.
-- A computer with a monitor (a 3x3 multiblock works great) placed in the
-- server room. Runs the full desktop shell rendered to the monitor, and
-- monitor_touch drives the window manager directly — tap to open apps,
-- toggle switches, pick list rows. No keyboard needed for navigation;
-- text fields (CONFIGURE) still want the mainframe terminal.
--
-- node.cfg extras:
--   role      = "console"
--   display   = "right"        -- monitor peripheral name (auto if unset)
--   textScale = 0.5

local config = require("factoryos.core.config")
local Node   = require("factoryos.net.node")
local shell  = require("factoryos.shell")

local cfg = config.loadOr("/factoryos/node.cfg", {})
cfg.role = "console"

local node = Node.new(cfg)
assert(node:open(), "console: no modem")

local h = shell.start(node, cfg)

node:on("monitor_touch", function(_, x, y) h.wm:touch(x, y) end)
node:on("mouse_click",   function(_, x, y) h.wm:touch(x, y) end)

node:run()
