From a36c6528b10cb5b5d48fbf30a941443f738c9dd1 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 1 Apr 2018 23:23:34 +0200 Subject: Terminal inside Lua window manager --- src/sysapp/login/main.lua | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/sysapp') diff --git a/src/sysapp/login/main.lua b/src/sysapp/login/main.lua index 67ce3fe..3aa0695 100644 --- a/src/sysapp/login/main.lua +++ b/src/sysapp/login/main.lua @@ -145,6 +145,31 @@ local grid = tk.grid({border_size = 1}, { wm:add({title = "Filesystems", x = 300, y = 20}, tk.box({vresize = true, hresize = true, vscroll = true, hscroll = true}, grid)) +function open_terminal(title, binfile) + local term_widget = tk.gipwidget({width = 480, height = 360}) + wm:add({title = title, x = 300, y = 200}, term_widget) + local tty_a, tty_b = sys.make_channel(false) + + local term_bin_pid = sys.new_proc() + sys.bind_fs(term_bin_pid, "sys", "sys") + sys.bind_fs(term_bin_pid, "config", "config") + sys.bind_fd(term_bin_pid, sysdef.STD_FD_GIP, term_widget.ch_cli) + sys.bind_fd(term_bin_pid, sysdef.STD_FD_TTYSRV, tty_a) + sys.dbg_print("Start terminal.bin, pid: " .. tonumber(term_bin_pid)) + sys.proc_exec(term_bin_pid, "sys:/bin/terminal.bin") + + local shell_bin_pid = sys.new_proc() + sys.bind_fs(shell_bin_pid, "root", "root") + sys.bind_fs(shell_bin_pid, "sys", "sys") + sys.bind_fs(shell_bin_pid, "config", "config") + sys.bind_fd(shell_bin_pid, sysdef.STD_FD_TTY_STDIO, tty_b) + sys.dbg_print("Start " .. binfile .. ", pid: " .. tonumber(shell_bin_pid)) + sys.proc_exec(shell_bin_pid, binfile) +end + +open_terminal("Shell", "sys:/bin/shell.bin") +open_terminal("Lua prompt", "sys:/bin/lx.bin") + mainloop.run() os.exit() -- cgit v1.2.3