SIGWINCH / Serial #1435
-
|
Did you find reasonable workarounds to make SIGWINCH work across the serial port? Calling I'm half-considering compiling a binary that would wrap a shell to implement a minimalistic protocol that could let me emit such signals, but it seems a little too hacky (especially since I didn't find any existing project doing that ... I feel like if it was a good idea other people would already do it ...). |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
#172 (comment) or use emulator.bus.send("virtio-consoleX-resize", [cols, rows])small virtio console example with xterm-fit-addon (inspired by alpine.sh)
<!doctype html>
<script src="libv86.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm@5.2.1/lib/xterm.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.8.0/lib/xterm-addon-fit.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@5.2.1/css/xterm.min.css">
<style>
/* for a better look */
body {
padding: 0;
margin: 0;
background-color: black;
}
#terminal {
width: 100vw;
height: 100vh;
margin: 0;
}
#terminal * {
overflow: hidden !important;
}
</style>
<script>
"use strict";
window.onload = function()
{
// v86 doesn't have a "serial_container_xtermjs" for virtio_console,
// so we implement the terminal ourselves
var term = window.term = new Terminal();
var fitaddon = new FitAddon.FitAddon();
term.loadAddon(fitaddon);
term.open(document.getElementById("terminal"));
fitaddon.fit();
var emulator = window.emulator = new V86({
wasm_path: "v86.wasm",
memory_size: 128 * 1024 * 1024,
vga_memory_size: 2 * 1024 * 1024,
bios: { url: "seabios.bin" },
vga_bios: { url: "vgabios.bin" },
bzimage: { url: "basic-v86-image.bin" },
cmdline: "console=hvc0", // see also https://blog.memzero.de/toying-with-virtio
virtio_console: true,
autostart: true,
});
var encoder = new TextEncoder();
// input handler
term.onData(data => emulator.bus.send("virtio-console0-input-bytes", encoder.encode(data)));
// resize handler
term.onResize(event => emulator.bus.send("virtio-console0-resize", [event.cols, event.rows]));
window.addEventListener("resize", () => fitaddon.fit());
// output handler
emulator.add_listener("virtio-console0-output-bytes", data => term.write(data));
}
</script>
<body>
<div id="terminal"></div>
</body> |
Beta Was this translation helpful? Give feedback.

#172 (comment) or use
virtio_consolewithresizeevent:small virtio console example with xterm-fit-addon (inspired by alpine.sh)