Skip to content

Commit 40aae8e

Browse files
committed
feat: update terminal title for better UX on windows
1 parent f45d2d8 commit 40aae8e

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

bundles/com.espressif.idf.terminal.connector/src/com/espressif/idf/terminal/connector/launcher/IDFConsoleLauncherDelegate.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
7979
Assert.isNotNull(properties);
8080

8181
// Set the terminal tab title
82-
String terminalTitle = getTerminalTitle();
83-
if (terminalTitle != null && !properties.containsKey(ITerminalsConnectorConstants.PROP_TITLE)) {
84-
properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
85-
}
82+
setTerminalTitle(properties);
8683

8784
// If not configured, set the default encodings for the local terminal
8885
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_ENCODING)) {
@@ -166,13 +163,20 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
166163
}
167164

168165
/**
169-
* Returns the terminal title string.
166+
* Setting the terminal title.
170167
* <p>
168+
* @param properties
171169
*
172-
* @return The terminal title string
170+
* @return void
173171
*/
174-
private String getTerminalTitle() {
175-
return Messages.IDFConsoleLauncherDelegate_ESPIDFTerminal;
172+
private void setTerminalTitle(Map<String, Object> properties) {
173+
if (properties.containsKey(ITerminalsConnectorConstants.PROP_TITLE)) {
174+
var projectName = properties.get(ITerminalsConnectorConstants.PROP_TITLE);
175+
properties.put(ITerminalsConnectorConstants.PROP_TITLE,
176+
String.format("%s (%s)", projectName, Messages.IDFConsoleLauncherDelegate_ESPIDFTerminal)); //$NON-NLS-1$
177+
} else {
178+
properties.put(ITerminalsConnectorConstants.PROP_TITLE, Messages.IDFConsoleLauncherDelegate_ESPIDFTerminal);
179+
}
176180
}
177181

178182
@Override

0 commit comments

Comments
 (0)