Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4311 from barni2000/master
Browse files Browse the repository at this point in the history
Add linux terminal emulator settings option
  • Loading branch information
jdrouet committed Dec 7, 2018
2 parents e5cd2f3 + 5a06bb3 commit 3d3f68d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
26 changes: 25 additions & 1 deletion src/components/Preferences.react.js
Expand Up @@ -13,6 +13,7 @@ var Preferences = React.createClass({
useVM: localStorage.getItem('settings.useVM') === 'true',
metricsEnabled: metrics.enabled(),
terminalShell: localStorage.getItem('settings.terminalShell') || "sh",
terminalPath: localStorage.getItem('settings.terminalPath') || "/usr/bin/xterm",
startLinkedContainers: localStorage.getItem('settings.startLinkedContainers') === 'true'
};
},
Expand Down Expand Up @@ -58,6 +59,13 @@ var Preferences = React.createClass({
});
localStorage.setItem('settings.terminalShell', value);
},
handleChangeTerminalPath: function (e) {
var value = e.target.value;
this.setState({
terminalPath: value
});
localStorage.setItem('settings.terminalPath', value);
},
handleChangeStartLinkedContainers: function (e) {
var checked = e.target.checked;
this.setState({
Expand All @@ -66,7 +74,7 @@ var Preferences = React.createClass({
localStorage.setItem('settings.startLinkedContainers', checked ? 'true' : 'false');
},
render: function () {
var vmSettings, vmShutdown, nativeSetting;
var vmSettings, vmShutdown, nativeSetting, linuxSettings;

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

if (process.platform === "linux") {
linuxSettings = (
<div>
<div className="option">
<div className="option-name">
<label htmlFor="terminalPath">Terminal path</label>
</div>
<div className="option-value">
<input id="terminalPath" type="text" value={this.state.terminalPath} onChange={this.handleChangeTerminalPath}/>
</div>
</div>
</div>
)
}

return (
<div className="preferences">
<div className="preferences-content">
Expand Down Expand Up @@ -137,6 +160,7 @@ var Preferences = React.createClass({
<input id="startLinkedContainers" type="checkbox" checked={this.state.startLinkedContainers} onChange={this.handleChangeStartLinkedContainers}/>
</div>
</div>
{linuxSettings}
</div>
</div>
);
Expand Down
7 changes: 4 additions & 3 deletions src/utils/Util.js
Expand Up @@ -201,13 +201,14 @@ module.exports = {
return linuxAbsPath.replace('/c', 'C:').split('/').join('\\');
},
linuxTerminal: function () {
if (fs.existsSync('/usr/bin/x-terminal-emulator')) {
return ['/usr/bin/x-terminal-emulator', '-e'];
const terminalPath = localStorage.getItem('settings.terminalPath');
if (fs.existsSync(terminalPath)) {
return [terminalPath, '-e'];
} else {
dialog.showMessageBox({
type: 'warning',
buttons: ['OK'],
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.'
message: `The ${terminalPath} does not exist please set the correct path.`
});
return false;
}
Expand Down

0 comments on commit 3d3f68d

Please sign in to comment.