mirror of
https://github.com/MeexReay/poshlostios.git
synced 2025-06-24 10:32:59 +03:00
help page and add date and time to taskbar
This commit is contained in:
parent
23c71f01ac
commit
3911454188
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "mxwm",
|
"name": "mxwm",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "Mega eXtreme Window Manager",
|
"description": "Mega eXtreme Window Manager",
|
||||||
"author": "MeexReay",
|
"author": "MeexReay",
|
||||||
"apps": [ "zcom.js", "startz.js", "zterm.js", "poki.js" ],
|
"apps": [ "zcom.js", "startz.js", "zterm.js", "poki.js", "zhelp.js" ],
|
||||||
"configs": []
|
"configs": [ "poki.json" ]
|
||||||
}
|
}
|
||||||
|
@ -11,17 +11,10 @@ let ctx = null
|
|||||||
|
|
||||||
const HEIGHT = 64
|
const HEIGHT = 64
|
||||||
|
|
||||||
const APPS = [
|
const APPS = JSON.parse(readFile("/config/poki.json"))
|
||||||
{
|
|
||||||
"id": "zterm",
|
|
||||||
"title": "zterm - terminal emulator",
|
|
||||||
"icon": "app/mxwm/zterm.png",
|
|
||||||
"script": ["/app/zterm.js"]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
||||||
const ICON_SIZE = 60
|
const ICON_SIZE = 52
|
||||||
const ICON_PADDING = 4
|
const ICON_PADDING = 6
|
||||||
|
|
||||||
function findRect() {
|
function findRect() {
|
||||||
return [0, graphics_canvas.height - HEIGHT, graphics_canvas.width, HEIGHT]
|
return [0, graphics_canvas.height - HEIGHT, graphics_canvas.width, HEIGHT]
|
||||||
@ -37,6 +30,23 @@ async function draw() {
|
|||||||
ctx.drawImage(app.icon_image, x, ICON_PADDING, ICON_SIZE, ICON_SIZE)
|
ctx.drawImage(app.icon_image, x, ICON_PADDING, ICON_SIZE, ICON_SIZE)
|
||||||
x += ICON_SIZE + ICON_PADDING
|
x += ICON_SIZE + ICON_PADDING
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.font = "bold 20px sans-serif";
|
||||||
|
ctx.textBaseline = "middle";
|
||||||
|
ctx.textAlign = "center";
|
||||||
|
ctx.fillStyle = "black";
|
||||||
|
|
||||||
|
const now = new Date();
|
||||||
|
|
||||||
|
const timeString = now.toTimeString().slice(0, 5)
|
||||||
|
|
||||||
|
const day = String(now.getDate()).padStart(2, '0');
|
||||||
|
const month = String(now.getMonth() + 1).padStart(2, '0');
|
||||||
|
const year = String(now.getFullYear()).slice(-2);
|
||||||
|
const dateString = `${day}.${month}.${year}`
|
||||||
|
|
||||||
|
ctx.fillText(timeString, ctx.canvas.width - 65, 22);
|
||||||
|
ctx.fillText(dateString, ctx.canvas.width - 65, 47);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onUpdate() {
|
async function onUpdate() {
|
||||||
|
14
app/mxwm/poki.json
Normal file
14
app/mxwm/poki.json
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": "zhelp",
|
||||||
|
"title": "help page",
|
||||||
|
"icon": "app/mxwm/zhelp.png",
|
||||||
|
"script": ["/app/zhelp.js"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "zterm",
|
||||||
|
"title": "zterm - terminal emulator",
|
||||||
|
"icon": "app/mxwm/zterm.png",
|
||||||
|
"script": ["/app/zterm.js"]
|
||||||
|
}
|
||||||
|
]
|
58
app/mxwm/zhelp.js
Normal file
58
app/mxwm/zhelp.js
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
eval(readFile("/app/zcom.js"))
|
||||||
|
|
||||||
|
const HELP_MESSAGE = `Помощь по MXWM:
|
||||||
|
|
||||||
|
Выключить оконный менеджер - Alt+Shift+Q
|
||||||
|
Создать новое окно ZTERM - Alt+Enter
|
||||||
|
Закрыть окно - Alt+Shift+C
|
||||||
|
Переместить окно - Зажмите мышкой на заголовке окна
|
||||||
|
ИЛИ Нажмите Alt и зажмите левой кнопки мышки на окне
|
||||||
|
Изменить размер окна - Зажмите мышкой на
|
||||||
|
правом нижнем углу окна
|
||||||
|
ИЛИ Нажмите Alt и зажмите правой кнопки мышки на окне`
|
||||||
|
|
||||||
|
let run = true
|
||||||
|
|
||||||
|
function draw(ctx) {
|
||||||
|
ctx.fillStyle = "white"
|
||||||
|
ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height)
|
||||||
|
|
||||||
|
ctx.font = "bold 14px terminus";
|
||||||
|
ctx.textBaseline = "middle";
|
||||||
|
ctx.textAlign = "left";
|
||||||
|
ctx.fillStyle = "black";
|
||||||
|
|
||||||
|
let y = 0
|
||||||
|
for (let line of HELP_MESSAGE.split("\n").reverse()) {
|
||||||
|
ctx.fillText(line, 10, ctx.canvas.height - 10 - y);
|
||||||
|
y += 18
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function main(args) {
|
||||||
|
let [wid, ctx] = createWindow({
|
||||||
|
"title": "help page",
|
||||||
|
"x": 50,
|
||||||
|
"y": 50,
|
||||||
|
"width": 420,
|
||||||
|
"height": 184,
|
||||||
|
"onresize": () => {
|
||||||
|
draw(ctx)
|
||||||
|
},
|
||||||
|
"onsignal": (s) => {
|
||||||
|
if (s == 9) run = false;
|
||||||
|
},
|
||||||
|
"resizable": false
|
||||||
|
})
|
||||||
|
|
||||||
|
draw(ctx)
|
||||||
|
|
||||||
|
while (run && graphics_canvas != null) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
|
draw(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
closeWindow(wid)
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
BIN
app/mxwm/zhelp.png
Normal file
BIN
app/mxwm/zhelp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 KiB |
@ -248,7 +248,9 @@ async function onKeyUp(key) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function main(args) {
|
async function main(args) {
|
||||||
[wid, ctx] = createWindow({
|
let run = true
|
||||||
|
|
||||||
|
let d = createWindow({
|
||||||
"title": "zterm",
|
"title": "zterm",
|
||||||
"app_id": "zterm",
|
"app_id": "zterm",
|
||||||
"width": 500,
|
"width": 500,
|
||||||
@ -257,24 +259,36 @@ async function main(args) {
|
|||||||
"y": 50,
|
"y": 50,
|
||||||
"onkeydown": onKeyDown,
|
"onkeydown": onKeyDown,
|
||||||
"onkeyup": onKeyUp,
|
"onkeyup": onKeyUp,
|
||||||
"onresize": (w,h) => draw()
|
"onresize": (w,h) => draw(),
|
||||||
|
"onsignal": (s) => {
|
||||||
|
if (s == 9) {
|
||||||
|
run = false
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
wid = d[0]
|
||||||
|
ctx = d[1]
|
||||||
|
|
||||||
draw()
|
draw()
|
||||||
|
|
||||||
await executeCommand(
|
executeCommand(
|
||||||
["/app/posh.js"],
|
["/app/posh.js"],
|
||||||
readStdin,
|
readStdin,
|
||||||
writeStdout,
|
writeStdout,
|
||||||
setStdinFlag,
|
setStdinFlag,
|
||||||
readLine,
|
readLine,
|
||||||
pollStdinEvent
|
pollStdinEvent
|
||||||
).promise
|
).promise.then(() => {
|
||||||
|
run = false
|
||||||
|
})
|
||||||
|
|
||||||
|
while (run && graphics_canvas != null) {
|
||||||
|
await new Promise(resolve => setTimeout(resolve, 100))
|
||||||
|
}
|
||||||
|
|
||||||
ctx = null
|
ctx = null
|
||||||
|
|
||||||
console.log("posh exit")
|
|
||||||
|
|
||||||
closeWindow(wid)
|
closeWindow(wid)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user