Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 2 additions & 120 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@
"yargs": "^17.7.2"
},
"browserslist": "cover 100%,not android < 5"
}
}
25 changes: 25 additions & 0 deletions src/components/terminal/terminalManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
}
}
};

Expand All @@ -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);
}

/**
Expand Down
23 changes: 23 additions & 0 deletions src/lib/editorFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/terminal/www/Terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
},

Expand Down
23 changes: 23 additions & 0 deletions src/settings/terminalSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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: {
Expand Down