diff --git a/package-lock.json b/package-lock.json index 80400ab01..0fa28bd8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10149,126 +10149,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/ts-loader": { - "version": "9.5.2", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.5.2.tgz", - "integrity": "sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.1.0", - "enhanced-resolve": "^5.0.0", - "micromatch": "^4.0.0", - "semver": "^7.3.4", - "source-map": "^0.7.4" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "typescript": "*", - "webpack": "^5.0.0" - } - }, - "node_modules/ts-loader/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/ts-loader/node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ts-loader/node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/ts-loader/node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/ts-loader/node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ts-loader/node_modules/semver": { - "version": "7.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", - "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", - "dev": true, - "license": "ISC", - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/ts-loader/node_modules/source-map": { - "version": "0.7.4", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", - "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">= 8" - } - }, - "node_modules/ts-loader/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/tslib": { "version": "1.14.1", "license": "0BSD" @@ -10324,6 +10204,8 @@ "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, "license": "Apache-2.0", + "optional": true, + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index f29ca0c5c..cb7df5654 100644 --- a/package.json +++ b/package.json @@ -129,4 +129,4 @@ "yargs": "^17.7.2" }, "browserslist": "cover 100%,not android < 5" -} +} \ No newline at end of file diff --git a/src/components/terminal/terminalManager.js b/src/components/terminal/terminalManager.js index f723837e4..f057b4141 100644 --- a/src/components/terminal/terminalManager.js +++ b/src/components/terminal/terminalManager.js @@ -223,6 +223,11 @@ class TerminalManager { terminalId, ); + // Set up custom title for installation terminal + terminalFile.setCustomTitle( + () => "Installing Terminal Environment...", + ); + const instance = { id: terminalId, name: terminalName, @@ -343,6 +348,15 @@ class TerminalManager { // Format terminal title as "Terminal ! - title" const formattedTitle = `Terminal ${this.terminalCounter} - ${title}`; terminalFile.filename = formattedTitle; + + // Refresh the header subtitle if this terminal is active + if ( + editorManager.activeFile && + editorManager.activeFile.id === terminalFile.id + ) { + // Force refresh of the header subtitle + terminalFile.setCustomTitle(getTerminalTitle); + } } }; @@ -366,6 +380,17 @@ class TerminalManager { terminalFile._terminalId = terminalId; terminalFile.terminalComponent = terminalComponent; terminalFile._resizeObserver = resizeObserver; + + // Set up custom title function for terminal + const getTerminalTitle = () => { + if (terminalComponent.pid) { + return `PID: ${terminalComponent.pid}`; + } + // fallback to terminal name + return `${terminalId}`; + }; + + terminalFile.setCustomTitle(getTerminalTitle); } /** diff --git a/src/lib/editorFile.js b/src/lib/editorFile.js index c8c96d64f..2004479fa 100644 --- a/src/lib/editorFile.js +++ b/src/lib/editorFile.js @@ -62,6 +62,12 @@ export default class EditorFile { */ stylesheets; + /** + * Custom title function for special tab types + * @type {function} + */ + #customTitleFn = null; + /** * If editor was focused before resize */ @@ -948,6 +954,18 @@ export default class EditorFile { this.#addCustomStyles(style, shadow); } + /** + * Set custom title function for special tab types + * @param {function} titleFn Function that returns the title string + */ + setCustomTitle(titleFn) { + this.#customTitleFn = titleFn; + // Update header if this file is currently active + if (editorManager.activeFile && editorManager.activeFile.id === this.id) { + editorManager.header.subText = this.#getTitle(); + } + } + /** * * @param {FileAction} action @@ -1196,6 +1214,11 @@ export default class EditorFile { } #getTitle() { + // Use custom title function if provided + if (this.#customTitleFn) { + return this.#customTitleFn(); + } + let text = this.location || this.uri; if (text && !this.readOnly) { diff --git a/src/plugins/terminal/www/Terminal.js b/src/plugins/terminal/www/Terminal.js index f376c5bbb..e7fb5d846 100644 --- a/src/plugins/terminal/www/Terminal.js +++ b/src/plugins/terminal/www/Terminal.js @@ -192,8 +192,9 @@ const Terminal = { return installResult; } catch (e) { - err_logger("Installation failed:", e); - return false; + err_logger("Installation failed:", e); + console.error("Installation failed:", e); + return false; } }, diff --git a/src/settings/terminalSettings.js b/src/settings/terminalSettings.js index e101b9872..d904e7542 100644 --- a/src/settings/terminalSettings.js +++ b/src/settings/terminalSettings.js @@ -10,6 +10,7 @@ import loader from "dialogs/loader"; import fonts from "lib/fonts"; import appSettings from "lib/settings"; import FileBrowser from "pages/fileBrowser"; +import helpers from "utils/helpers"; export default function terminalSettings() { const title = strings["terminal settings"]; @@ -173,6 +174,11 @@ export default function terminalSettings() { text: strings.restore.capitalize(), info: "Restores a backup of the terminal installation", }, + { + key: "uninstall", + text: strings.uninstall.capitalize(), + info: "Uninstalls the terminal installation", + }, ]; return settingsPage(title, items, callback); @@ -206,6 +212,23 @@ export default function terminalSettings() { terminalRestore(); return; + case "uninstall": + loader.showTitleLoader(); + Terminal.uninstall() + .then(() => { + loader.removeTitleLoader(); + alert( + strings.success.toUpperCase(), + "Terminal uninstalled successfully.", + ); + }) + .catch((error) => { + loader.removeTitleLoader(); + console.error("Terminal uninstall failed:", error); + helpers.error(error); + }); + return; + default: appSettings.update({ terminalSettings: {