diff options
author | Alex Auvolat <alex@adnab.me> | 2018-04-01 23:23:34 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-04-01 23:23:34 +0200 |
commit | a36c6528b10cb5b5d48fbf30a941443f738c9dd1 (patch) | |
tree | 19249d98dbe3a55d5f18050797959d7ca64a97bd /src/sysapp | |
parent | 67db86ec53336da886153797deb643483e9596d0 (diff) | |
download | kogata-a36c6528b10cb5b5d48fbf30a941443f738c9dd1.tar.gz kogata-a36c6528b10cb5b5d48fbf30a941443f738c9dd1.zip |
Terminal inside Lua window manager
Diffstat (limited to 'src/sysapp')
-rw-r--r-- | src/sysapp/login/main.lua | 25 |
1 files changed, 25 insertions, 0 deletions
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() |