move zterm to new app

This commit is contained in:
MeexReay 2025-05-23 23:41:04 +03:00
parent b4d52498da
commit 7560e4d7af
3 changed files with 40 additions and 22 deletions

View File

@ -3,6 +3,6 @@
"version": "0.1.0", "version": "0.1.0",
"description": "Mega eXtreme Window Manager", "description": "Mega eXtreme Window Manager",
"author": "MeexReay", "author": "MeexReay",
"apps": [ "zcom.js", "startz.js" ], "apps": [ "zcom.js", "startz.js", "zterm.js" ],
"configs": [] "configs": []
} }

View File

@ -19,9 +19,9 @@ async function drawWindowDecorations(ctx, x, y, width, height, title) {
const buttonSpacing = 8; const buttonSpacing = 8;
const outerX = x - borderWidth - 1; const outerX = x - borderWidth - 1;
const outerY = y - headerHeight - borderWidth - 1; const outerY = y - headerHeight - borderWidth - 2;
const outerWidth = width + borderWidth * 2; const outerWidth = width + borderWidth * 2 + 1;
const outerHeight = height + headerHeight + borderWidth * 2; const outerHeight = height + headerHeight + borderWidth * 2 + 2;
ctx.fillStyle = "#f4f4f4"; ctx.fillStyle = "#f4f4f4";
ctx.fillRect(outerX, outerY, outerWidth, outerHeight) ctx.fillRect(outerX, outerY, outerWidth, outerHeight)
@ -34,23 +34,7 @@ async function drawWindowDecorations(ctx, x, y, width, height, title) {
} }
async function onStart(screen_ctx) { async function onStart(screen_ctx) {
let wid, ctx = createWindow({ executeCommand(["/app/zterm.js"])
"title": "zterm",
"width": 500,
"height": 500,
"x": 50,
"y": 50,
"onkeydown": key => {
ctx.fillStyle = "#222";
ctx.font = "bold 14px sans-serif";
ctx.textBaseline = "middle";
ctx.textAlign = "left";
ctx.fillText(key, 10, 10);
}
})
ctx.fillStyle = "cyan"
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)
} }
async function onKeyDown(ctx, key) { async function onKeyDown(ctx, key) {

34
app/mxwm/zterm.js Normal file
View File

@ -0,0 +1,34 @@
eval(readFile("/app/zcom.js"))
var text = ""
async function draw(ctx) {
ctx.fillStyle = "cyan"
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)
ctx.fillStyle = "#222";
ctx.font = "bold 14px sans-serif";
ctx.textBaseline = "middle";
ctx.textAlign = "left";
ctx.fillText(text, 10, 10);
}
async function onKeyDown(key) {
text += key
}
async function main(args) {
let wid, ctx = createWindow({
"title": "zterm",
"width": 500,
"height": 500,
"x": 50,
"y": 50,
"onkeydown": onKeyDown
})
while (graphics_canvas != null) {
draw(ctx)
await new Promise(res => setTimeout(res, 100));
}
}