Here is my hyper.js file:
https://gist.github.com/OmriSama/5193f8bfff4371369cc3ae3d30f56781
Hi everyone. I spent a good chunk of time today updating my Windows 10 to the latest version so I could use wsl.exe
instead of bash.exe
; now I have zsh
set as my default shell and after getting annoyed with Cmder I decided to give Hyper another try (although start up times are slow, it does look really nice).
An issue:
Albeit slow, context menu "Open Hyper Here" works fine.
What doesn't work fine is a normal startup from say, a shortcut I have on the Taskbar. My default shell is set to wsl.exe
and yet still, my normal terminal window starts in $HOME
while my Hyper decides to start up in Users/myusername
.
This is really confusing and I have no idea why it's doing this. I'm very tempted to get the Dev build going so I can maybe debug it? But I was hoping someone here would have insight first...
Thanks everyone
one step of the issue template (that you removed) is to copy your .hyper.js contents to a gist (or similar), could you do that?
--login
or not to shellArgs and not have to ask you 馃憤 https://github.com/zeit/hyper/blob/canary/app/config/config-default.js#L92
Thanks 馃檶
@albinekb hi! I added it in the OP. Let me know :)
Having the same issue but I'm on canary. If I boot up just WSL /w Zsh, I start in $HOME. When I boot up through Hyper, I start in my Windows user folder.
https://gist.github.com/mwcarew/1562f88dd6af1d233d7704044714638b
Everything is working wonderfully otherwise!
If I do this "shellArgs: ['~']" then hyper launches in my WSL home on Windows instead of the Windows user directory.
I'm not on my home PC for a while and can't mess with this, but would that affect my launch location if I'm right-clicking in Explorer to use the context option "Open Hyper here"? I'd imagine I'd now start in my home directory regardless.
On my machine it opens in my WSL home even from explorer.
OK yeah. Not quite the behavior I'm hoping for from it.
How can I set an default startup folder like D:\Works instead of '~'
I'm using Git bash for Windows because wsl is very slow on node process. I have tried with
{
shell: 'C:\\Program Files\\Git\\bin\\bash.exe',
shellArgs: ['D:\\Works']
}
but it does not work
Open .zshrc file using vim or nano, at the bottom, add :
cd ~
Save and restart Hyper Terminal
Adding cd ~
to your .zshrc causes problems elsewhere (e.g. using WSL Bash in VSCode). Simple fix I found was to use this in my hyper config
shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: ['-c', 'cd ~ && zsh']
@benc-uk solution is nice! I can keep bash and use zsh in hyper (better than chsh
to zsh). Note that if you use shell args, make sure your shell points to 'C:\\Windows\\System32\\bash.exe'
. Pointing it to 'C:\\Windows\\System32\\wsl.exe'
will cause hyper to quit as soon as it launches.
If you're trying to use wsl.exe, keep in mind it has it's own argument parsing rules (which are different than bash.exe which passes everything along to /bin/bash).
shell: 'C:\\Windows\\System32\\wsl.exe',
// for setting shell arguments (i.e. for using interactive shellArgs: `['-i']`)
// by default `['--login']` will be used
shellArgs: [],
The wsl.exe method is a lot better than my workaround :)
@benc-uk That depends. E.g., I use fish/zsh shell. If I change my shell to fish/zsh via chsh
, and then use wsl.exe
, what I found is not everything works as expected - especially with node version manager switching versions, or installing node modules. However, if I launch bash and then switch to fish/zsh (either manually or via bashrc), things work a lot better.
Further, if there are scripts/packages that expect bash to behave like bash, chsh
kind of interferes with that.
Slight variant of Ben's that I've just tested out. It replaces the current shell rather than going into a child shell:
shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: ['-c', 'cd ~ && exec $SHELL'],
@sandangel, for Git Bash (which I dislike myself, but I understand your reasons), your config would probably be:
shell: 'C:\\Program Files\\Git\\bin\\bash.exe',
shellArgs: ['-c', 'cd /d/Works ~ && exec $SHELL'],
In WSL then that folder would be /mnt/d/Works.
I was just revisiting my hyper.js config and the bash.exe route I was using bugged me slightly.
After some trial and error the most elegant solution I've found so far is this
shell: 'C:\\Windows\\System32\\wsl.exe',
shellArgs: ['~']
It's better IMO than starting bash to then launch another shell, the startup seems fractionally faster
bash.exe
is deprecated anyway, everything should go through wsl.exe
This is my shell:
shell: 'C:\\Windows\\System32\\bash.exe',
I removed the --login
from 'shellArgs' and added the code below
shellArgs: ['-c', 'cd ~/../../mnt/d/hauck/code/react-apps/ && exec $SHELL'],
Now it opens to the file I desire.
@TJVaughn stop using bash.exe, wsl.exe instead
@Stanzilla If that's the case the hyper.js
config file should be updated accordingly. Otherwise, the helper text makes it quite confusing. Last time I checked it still said the following:
// Bash on Windows
// - Example: `C:\\Windows\\System32\\bash.exe`
@benc-uk Thanks for your answer. wsl.exe
with ~
shellArgs works perfectly with zsh.
Yup!
This was the best solution for me if I wanted to start in D:\Coding, which was not the $HOME folder. This info was kind of hard to find so thought I'd post here
shell: 'C:\\Windows\\System32\\bash.exe',
shellArgs: ["-c", "cd /mnt/d/Coding && exec /mnt/c/Windows/System32/wsl.exe"]
I find this really annoying, but I found one possible solution. Running [distribution.exe]
instead of wsl.exe
or bash.exe
always make you start in $HOME
.
For instance, I'm using Debian so I'm having this configuration
{
shell: "debian.exe",
shellArgs: []
}
The downside is if you switch your default distribution you have to update .hyper.js
, but if you only ever use one distro it's probably not a big deal.
That works for starting directly, but breaks the right click "Open Hyper here" link; it always opens the home directory.
What worked for me was to alter the shortcut you have (on the taskbar, wherever) so that its target is ...Hyper.exe \\wsl$\Ubuntu\home\matthew
(changing to your own distro/homedir of course). This maintains it working from Explorer and launches in the linux home directory when starting that shortcut directly.
Adding
cd ~
to your .zshrc causes problems elsewhere (e.g. using WSL Bash in VSCode). Simple fix I found was to use this in my hyper configshell: 'C:\\Windows\\System32\\bash.exe', shellArgs: ['-c', 'cd ~ && zsh']
Thank you! You solved all my problems!
Most helpful comment
If I do this "shellArgs: ['~']" then hyper launches in my WSL home on Windows instead of the Windows user directory.