diff options
author | WlodekM <[email protected]> | 2025-01-24 19:47:56 +0200 |
---|---|---|
committer | WlodekM <[email protected]> | 2025-01-24 19:47:56 +0200 |
commit | b4f992ffdac2d3d7f1dcb1042a3b663c2643809a (patch) | |
tree | 57c911b7021b688b9873319d9eebb43f734e533b /screen | |
parent | f473bfa775e51c88fd5d23d0565b3da05134afc4 (diff) |
theoretically change window title
Diffstat (limited to 'screen')
-rw-r--r-- | screen/home.ts | 9 | ||||
-rw-r--r-- | screen/login.ts | 18 |
2 files changed, 25 insertions, 2 deletions
diff --git a/screen/home.ts b/screen/home.ts index c6f6c19..296fec2 100644 --- a/screen/home.ts +++ b/screen/home.ts @@ -3,6 +3,14 @@ import { Screen } from "../screen.ts"; import type { Input, Text } from "../elements.ts"; import process from "node:process"; +function changeTitle(title: string) { + if (process.platform == 'win32') { + process.title = title; + } else { + process.stdout.write(`\x1b]2;${title}\x1b\x5c`); + } +} + export default { elements: [ { @@ -49,5 +57,6 @@ export default { onload (screen: Screen) { screen.client.setScreen(screen) screen.client.loadHome(screen) + changeTitle(`maelink - home`) } } \ No newline at end of file diff --git a/screen/login.ts b/screen/login.ts index 57121bb..57b269f 100644 --- a/screen/login.ts +++ b/screen/login.ts @@ -3,6 +3,15 @@ import { Screen } from "../screen.ts"; import { build } from "../screenbuilder.ts"; import HomeScreen from "./home.ts"; import { Input } from "../elements.ts"; +import process from "node:process" + +function changeTitle(title: string) { + if (process.platform == 'win32') { + process.title = title; + } else { + process.stdout.write(`\x1b]2;${title}\x1b\x5c`); + } +} export default { elements: [ @@ -42,15 +51,20 @@ export default { this.off() this.logs.push(`clicked button`) console.clear() - console.log("logging in...") + changeTitle('maelink - logging in...') + this.logs.push("logging in...") const usernameInput = this.elements.get("username-input") as Input; const passwordInput = this.elements.get("password-input") as Input; await this.client.login(usernameInput.value, passwordInput.value) + changeTitle('maelink - logged in as ' + usernameInput.value) build(HomeScreen, this.client); this.client }] } ], focus: "username-input", - name: 'login' + name: 'login', + onload() { + changeTitle(`maelink - log in`) + } } \ No newline at end of file |