Skip to content

Commit a2bfddd

Browse files
committed
feat: add terminal button in toolbar
1 parent af65642 commit a2bfddd

3 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/extensionsIntegrated/Terminal/main.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,32 @@ define(function (require, exports, module) {
879879
CommandManager.get(CMD_TERMINAL_CLEAR).setEnabled(!!active);
880880
});
881881

882+
function _createToolbarButton() {
883+
const $btn = $("<a>")
884+
.attr({
885+
id: "terminal-toolbar-button",
886+
href: "#",
887+
title: Strings.CMD_VIEW_TERMINAL
888+
})
889+
.insertBefore("#app-drawer-button");
890+
891+
$btn.on("click", function () {
892+
CommandManager.execute(CMD_VIEW_TERMINAL);
893+
});
894+
895+
const PanelView = require("view/PanelView");
896+
PanelView.on(PanelView.EVENT_PANEL_SHOWN, function (_event, panelId) {
897+
if (panelId === PANEL_ID) {
898+
$btn.addClass("selected-button");
899+
}
900+
});
901+
PanelView.on(PanelView.EVENT_PANEL_HIDDEN, function (_event, panelId) {
902+
if (panelId === PANEL_ID) {
903+
$btn.removeClass("selected-button");
904+
}
905+
});
906+
}
907+
882908
// Initialize on app ready
883909
AppInit.appReady(function () {
884910
if (Phoenix.isSpecRunnerWindow) {
@@ -887,6 +913,7 @@ define(function (require, exports, module) {
887913

888914
_initNodeConnector();
889915
_createPanel();
916+
_createToolbarButton();
890917

891918
// Gate user-initiated panel close (X button): confirm if needed, then
892919
// dispose all terminals. Programmatic hide() just collapses the panel

src/styles/brackets.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,12 @@ a, img {
12001200
background-size: 16px;
12011201
}
12021202

1203+
#terminal-toolbar-button {
1204+
background-image: url("images/toolbar-terminal.svg");
1205+
background-position: center;
1206+
background-size: 16px;
1207+
}
1208+
12031209
/* Project panel */
12041210

12051211
#working-set-list-container {
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)