Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 3d3f68d

Browse files
authored
Merge pull request #4311 from barni2000/master
Add linux terminal emulator settings option
2 parents e5cd2f3 + 5a06bb3 commit 3d3f68d

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

src/components/Preferences.react.js

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ var Preferences = React.createClass({
1313
useVM: localStorage.getItem('settings.useVM') === 'true',
1414
metricsEnabled: metrics.enabled(),
1515
terminalShell: localStorage.getItem('settings.terminalShell') || "sh",
16+
terminalPath: localStorage.getItem('settings.terminalPath') || "/usr/bin/xterm",
1617
startLinkedContainers: localStorage.getItem('settings.startLinkedContainers') === 'true'
1718
};
1819
},
@@ -58,6 +59,13 @@ var Preferences = React.createClass({
5859
});
5960
localStorage.setItem('settings.terminalShell', value);
6061
},
62+
handleChangeTerminalPath: function (e) {
63+
var value = e.target.value;
64+
this.setState({
65+
terminalPath: value
66+
});
67+
localStorage.setItem('settings.terminalPath', value);
68+
},
6169
handleChangeStartLinkedContainers: function (e) {
6270
var checked = e.target.checked;
6371
this.setState({
@@ -66,7 +74,7 @@ var Preferences = React.createClass({
6674
localStorage.setItem('settings.startLinkedContainers', checked ? 'true' : 'false');
6775
},
6876
render: function () {
69-
var vmSettings, vmShutdown, nativeSetting;
77+
var vmSettings, vmShutdown, nativeSetting, linuxSettings;
7078

7179
if (process.platform !== 'linux') {
7280
// We are on a Mac or Windows
@@ -104,6 +112,21 @@ var Preferences = React.createClass({
104112
);
105113
}
106114

115+
if (process.platform === "linux") {
116+
linuxSettings = (
117+
<div>
118+
<div className="option">
119+
<div className="option-name">
120+
<label htmlFor="terminalPath">Terminal path</label>
121+
</div>
122+
<div className="option-value">
123+
<input id="terminalPath" type="text" value={this.state.terminalPath} onChange={this.handleChangeTerminalPath}/>
124+
</div>
125+
</div>
126+
</div>
127+
)
128+
}
129+
107130
return (
108131
<div className="preferences">
109132
<div className="preferences-content">
@@ -137,6 +160,7 @@ var Preferences = React.createClass({
137160
<input id="startLinkedContainers" type="checkbox" checked={this.state.startLinkedContainers} onChange={this.handleChangeStartLinkedContainers}/>
138161
</div>
139162
</div>
163+
{linuxSettings}
140164
</div>
141165
</div>
142166
);

src/utils/Util.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,13 +201,14 @@ module.exports = {
201201
return linuxAbsPath.replace('/c', 'C:').split('/').join('\\');
202202
},
203203
linuxTerminal: function () {
204-
if (fs.existsSync('/usr/bin/x-terminal-emulator')) {
205-
return ['/usr/bin/x-terminal-emulator', '-e'];
204+
const terminalPath = localStorage.getItem('settings.terminalPath');
205+
if (fs.existsSync(terminalPath)) {
206+
return [terminalPath, '-e'];
206207
} else {
207208
dialog.showMessageBox({
208209
type: 'warning',
209210
buttons: ['OK'],
210-
message: 'The symbolic link /usr/bin/x-terminal-emulator does not exist. Please read the Wiki at https://github.com/docker/kitematic/wiki/Early-Linux-Support for more information.'
211+
message: `The ${terminalPath} does not exist please set the correct path.`
211212
});
212213
return false;
213214
}

0 commit comments

Comments
 (0)