From cc679a5922dba12bf9e1745c42d83ee556ca3c38 Mon Sep 17 00:00:00 2001 From: MeexReay Date: Sat, 22 Mar 2025 02:03:15 +0300 Subject: [PATCH] add escape button startz --- app/mxwm/startz.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/mxwm/startz.js b/app/mxwm/startz.js index 316c3fe..ac7f716 100644 --- a/app/mxwm/startz.js +++ b/app/mxwm/startz.js @@ -7,7 +7,22 @@ async function main(args) { let ctx = getGraphics() - while (true) { + let run = true + + (async () => { + while (true) { + let event = await pollStdinEvent() + + if (event.type == "key") { + if (event.key == "Escape") { + run = false + return + } + } + } + })() + + while (run) { ctx.fillStyle = "black" ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)