-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented support for mutliple shell definitions #1347
Conversation
.gitignore
Outdated
@@ -11,3 +11,5 @@ npm-debug.log | |||
.hyper.js | |||
.hyper_plugins | |||
|
|||
# IDEs | |||
.idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add this to your global .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah good point, thanks for that
will do 👍
.gitignore
Outdated
@@ -10,4 +10,3 @@ npm-debug.log | |||
# optional dev config file and plugins directory | |||
.hyper.js | |||
.hyper_plugins | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you put that blank line back again? 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, sorry for not noticing that XD
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually it was the other way around, the new line was missing in the repo
my IDE inserted it according to the .editorconfig
@@ -50,6 +49,7 @@ const config = require('./config'); | |||
|
|||
config.init(); | |||
|
|||
const createMenu = require('./menu'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you move it up there where it was before? There's no need for this change 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually there is a need for this change, the createMenu file now relies on configuration options, therefore must be required after the config is initialised.
@@ -1,11 +1,15 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need use strict
😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use ES6 features on node properly it is required
e.g. my use of for (const shellName of Object.keys(shells)) {
will break without it. Other than node 6 the above behaviour change with or without use strict
. Without it shellName
is set on the first iteration and remains constant for all other iterations. With it shellName is a constant to the scope of the loops inner block, however changes properly with each iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If anyone else is confused try this in node 5
var a = [1,2,3,4,5,6]; for (const b of a) { console.log(b); }
vs
'use strict'; var a = [1,2,3,4,5,6]; for (const b of a) { console.log(b); }
Removing the 'use strict';
would essentially mean dropping support for anything less than node 6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's OK now since hyper is running on node 7.4 since #1848 👌
lib/actions/term-groups.js
Outdated
@@ -12,14 +12,16 @@ import getRootGroups from '../selectors'; | |||
import {setActiveSession, ptyExitSession, userExitSession} from './sessions'; | |||
|
|||
function requestSplit(direction) { | |||
return () => (dispatch, getState) => { | |||
return (options) => (dispatch, getState) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the parenthesis around options
– it's not needed for a single function argument
lib/index.js
Outdated
@@ -64,16 +64,16 @@ rpc.on('session clear req', () => { | |||
store_.dispatch(sessionActions.clearActiveSession()); | |||
}); | |||
|
|||
rpc.on('termgroup add req', () => { | |||
store_.dispatch(termGroupActions.requestTermGroup()); | |||
rpc.on('termgroup add req', (options) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the parenthesis around options
– it's not needed for a single function argument
rpc.on('termgroup add req', () => { | ||
store_.dispatch(termGroupActions.requestTermGroup()); | ||
rpc.on('termgroup add req', (options) => { | ||
store_.dispatch(termGroupActions.requestTermGroup(options)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean??? that's a function call
lib/index.js
Outdated
}); | ||
|
||
rpc.on('split request horizontal', () => { | ||
store_.dispatch(termGroupActions.requestHorizontalSplit()); | ||
rpc.on('split request horizontal', (options) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
rpc.on('split request horizontal', () => { | ||
store_.dispatch(termGroupActions.requestHorizontalSplit()); | ||
rpc.on('split request horizontal', (options) => { | ||
store_.dispatch(termGroupActions.requestHorizontalSplit(options)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean??? that's a function call
lib/index.js
Outdated
}); | ||
|
||
rpc.on('split request vertical', () => { | ||
store_.dispatch(termGroupActions.requestVerticalSplit()); | ||
rpc.on('split request vertical', (options) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
rpc.on('split request vertical', () => { | ||
store_.dispatch(termGroupActions.requestVerticalSplit()); | ||
rpc.on('split request vertical', (options) => { | ||
store_.dispatch(termGroupActions.requestVerticalSplit(options)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you mean??? that's a function call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlmirKadric Thanks for the PR and sorry for the delay!
Please fix the minor issues I outlined in the review 👌
Besides that:
|
My
|
@matheuss I'll fix the other suggestions as well. Caught up with something else right now, will jump on it as soon as I'm done with that. |
@matheuss after taking another look at the code, a reducer isn't required. Any other suggestions or corrections to my above statements welcome. |
app/index.js
Outdated
@@ -186,7 +186,8 @@ app.on('ready', () => installDevExtensions(isDev).then(() => { | |||
// If no callback is passed to createWindow, | |||
// a new session will be created by default. | |||
if (!fn) { | |||
fn = win => win.rpc.emit('termgroup add req'); | |||
const shellOpts = options.shellOpts; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to test if options.shellOpts
exist
bump???? |
lib/index.js
Outdated
}); | ||
|
||
rpc.on('split request horizontal', () => { | ||
store_.dispatch(termGroupActions.requestHorizontalSplit()); | ||
rpc.on('split request horizontal',options => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lack of space rpc.on('split request horizontal', options => {
✌️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry @AlmirKadric have not had time to look at this, will look trough it tonight 🤘 |
@albinekb did you have time yet? Really would love to get this in. |
app/menu.js
Outdated
submenu: [] | ||
}; | ||
|
||
for (const shellName of Object.keys(shells)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would save Object.keys(shells)
as a const since you're using it twice in this file? 🤔
const shellKeys = Object.keys(shells)
?
dcc5409
to
bac6c0c
Compare
bac6c0c
to
638f461
Compare
Pulled from master and squashed into a single commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 for me this is ready for merge
ping @matheuss |
I just gave this a try... works well. Needs a rebase and some error trapping (for example bad paths). |
One other minor change: this needs to be documented (probably in the default config file), otherwise people won't find the new feature. |
Is this going to be merged in anytime soon? |
Anything specifically holding this PR up? I want this badly enough that I'd take it on if @AlmirKadric doesn't have the time to move forward with it. |
@Harangue from what I'm reading above, the remaining items are
@albinekb @matheuss can you please confirm this is the last of the changes I've actually made my own terminal multiplexer using similar technologies as a result since I couldn't wait for my changes to be merged, and branching from hyper didn't make sense as I wanted to make some fundamental design changes (would have been a complete rewrite of the underlying architecture) |
I would really love to see this in as well -- what is still left to be done, since this was started about a year ago? |
@CameronMaxwell @eamodio Alternatively feel free to take a look at my own terminal multiplexer here: |
Did this die with version 2's release? |
@AlmirKadric willing to pick this up again? I think a solution like Terminus https://github.com/Eugeny/terminus would be nice |
@Stanzilla unfortunately too much time has passed and I have since moved await from hyper and build my own terminal multiplexer using similar tech. The current beta version fills all my needs including the above feature. Even if I were to pick this up again, I believe enough code has changed that I would be essentially re-implementing the feature. As such I would suggest anyone who needs the feature to start again. |
I've implemented an additional menu item in File which allows you to select other shells that may have been configured inside your config file. My use case was for Windows (Bash vs Powershell), but this would apply to macos and linux for anyone who uses more than a single shell flavour. I wanted to make this a plugin, however the work was too integrated for this to be possible (or rather so simple enough).
Possible enhancements to this PR:
Please let me know if any of the above or other fixes are required, and I'll jump on it as soon as I can.
P.S. PR checks are failing due to external code which I didn't touch. Seems someone pushed bad code to master...