Skip to content

Commit 4945aea

Browse files
super unsecret program idea
1 parent 24e7b75 commit 4945aea

3 files changed

Lines changed: 82 additions & 2 deletions

File tree

src/programs/@ALL.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ export { default as spark } from "./spark";
4040
export { default as ipc_bg_test } from "./ipc_bg_test";
4141
export { default as ipc_fg_test } from "./ipc_fg_test";
4242

43+
// shhhhh!
44+
export { default as tb_test } from "./taskbar_test";
45+
4346
export { default as trigger_create_trigger } from "./pkg/triggers/create_trigger";
4447
export { default as trigger_remove_trigger } from "./pkg/triggers/remove_trigger";
4548

src/programs/help.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ANSI, NEWLINE, ANSI_ESCAPE_REGEX } from "../term_ctl";
2-
import type { Program, arg_descriptions } from "../types";
2+
import type { Program, ArgDescriptions } from "../types";
33

44

55
// deferred to prevent double printing of header if program has to re-execute itself
@@ -184,7 +184,7 @@ export default {
184184
// recurse each level of nesting
185185
// each level is a section title, until the innermost object, in which they are pairs of argument name and description.
186186
// add indents depending on the level of nesting
187-
const recurse = (descs: arg_descriptions, nest_level: number): string => {
187+
const recurse = (descs: ArgDescriptions, nest_level: number): string => {
188188
let output = "";
189189

190190
for (const [key, value] of Object.entries(descs)) {

src/programs/taskbar_test.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import type { Program } from "../types";
2+
3+
export default {
4+
name: "taskbar_test",
5+
description: "",
6+
usage_suffix: "",
7+
arg_descriptions: {},
8+
compat: "2.0.0",
9+
hide_from_help: true,
10+
completion: async () => [],
11+
main: async (data) => {
12+
// extract from data to make code less verbose
13+
const { kernel, term, process, shell } = data;
14+
15+
if (!kernel.has_window_manager()) {
16+
term.writeln("This program requires a window manager.");
17+
return 1;
18+
}
19+
20+
const wind = process.create_window();
21+
22+
wind.title = "Taskbar";
23+
24+
wind.set_custom_flag("no-top-bar", true);
25+
26+
wind.x = "0vw";
27+
wind.y = "92.5vh";
28+
29+
wind.height = "7.5vh";
30+
wind.width = "100vw";
31+
32+
const buttons = document.createElement("div");
33+
buttons.style.display = "flex";
34+
buttons.style.height = "100%";
35+
buttons.style.alignItems = "center";
36+
buttons.style.gap = "1vh";
37+
buttons.style.padding = "0 1vh";
38+
39+
wind.dom.appendChild(buttons);
40+
41+
const fsedit_button = document.createElement("button");
42+
fsedit_button.innerText = "FSEdit";
43+
fsedit_button.style.height = "100%";
44+
fsedit_button.style.fontSize = "2vh";
45+
fsedit_button.onclick = () => {
46+
kernel.spawn("fsedit", [], shell);
47+
};
48+
49+
buttons.appendChild(fsedit_button);
50+
51+
// if minecraft is installed, add a button for it
52+
const fs = kernel.get_fs();
53+
if (await fs.exists("/usr/bin/minecraft")) {
54+
const mc_button = document.createElement("button");
55+
mc_button.style.height = "100%";
56+
mc_button.style.fontSize = "2vh";
57+
mc_button.onclick = () => {
58+
kernel.spawn("minecraft", [], shell);
59+
};
60+
61+
const mc_image = document.createElement("img");
62+
mc_image.src = "https://brandlogos.net/wp-content/uploads/2022/07/minecraft-logo_brandlogos.net_faqdi-512x560.png";
63+
mc_image.style.height = "100%";
64+
mc_image.style.objectFit = "contain";
65+
mc_image.alt = "Minecraft";
66+
mc_image.draggable = false;
67+
mc_button.appendChild(mc_image);
68+
69+
buttons.appendChild(mc_button);
70+
}
71+
72+
wind.show();
73+
74+
process.detach();
75+
return 0;
76+
}
77+
} as Program;

0 commit comments

Comments
 (0)