Tilix and Zsh on Windows 10

Windows Subsystem for Linux

Published:

3 minute read

photo of Adrian Grimm

By: Adrian Grimm

Software-Developer, -DevOp, -Architect, -Analyst, Scrum-Master and more.

Tilix with Zsh running on WSL on Windows 10.

I like all major Operating-Systems for different reasons and tasks. But for me there is only one perfect shell: "Zsh". The Z-shell is for me the right mix of a stable, extendable, modern and universal shell. On MacOS it's already the new default shell and on Linux it's easy to install. On Windows it's also no problem, but to get it working with same smooth expirience like on Linux or MacOS, I use some tools chained together.

To be clear: Yes, Microsoft has a mighty PowerShell, CMD and Git-Bash is also available for Windows. But in my humble opinion - nothing beats a zsh with the power of linux/unix commandline tool repository.

WSL Tuning

The Windows Subsystem for Linux is a great Feature that came with Windows 10. I think every DevOp who is working with more than only Microsoft based Operating-Systems should get firm with it.

If you run WSL, the first decission is which Linux distribution you want to run. All the big ones are available (Ubuntu, Debian, Fedora, etc.). My choice was Pengwin - it's based on Debian, but it's customised for the use with WSL.

I installed ZSH and OhMyZSH together with a bunch of plugins to achieve a faster input expirience and a better visualization of context.

Visualization and UI/UX in general could be a pain on a terminal. Not every terminal is capeable to render the shell output as it intendet to be or handle all keyboard and mouse input right - and yes mouse input support could be great with TMux, NVim, EMacs or other commandline tools. Regarding the UI you can customize colors and fonts as you want, also in terms of syntax highlighting. The defaults are always reduced to a basic configuration. In my case I like to use Nerd Fonts and a special shell promt that relies on the usage of PowerLine, Lingatures and other font features like icons etc.

Tilix

On MacOS I would always recomend iTerm2, but for Linux I like Tilix. Tilix is a feature rich and fast terminal which does not need a lot of resources to run, but on Windows it isn't available. The default on Windows 10 is still the ugly CMD or as alternative the PowerShell - both terminals are OK if you only require to input/output some letters or run a script, but it's not enjoyable to work with beyond that.

The best Windows native terminal is the new Windows Terminal from Microsoft - it's still in development - maybe there is a first stable release in April 2020 available. But until now it still has a lot of missing features.

The next best terminal running on Windows IMHO is Terminus, but it's a heavy ElectronJS based terminal which needs a lot of resources to run.

The good thing is that it is possible to run Tilix on Windows through WSL and it's not as tricky as it sounds like. You only need the X11 stack and a X Server for Windows. This sounds like a lot of overhead but it realy isn't the case.

As X Window System(X11) I can highly recomend X410 from Choung Networks - it's a fast reliable light weight implementation of X11 for Windows 10.

I use a little trick to hide a default terminal session window in the background through a TMux-Server to show up Tilix. To achive this you only need a link in Windows with this command:

C:\Windows\System32\wsl.exe -d WLinux -- tmux -c "zsh ~/Tilix_WSL-Launcher.zsh"

And in the WSL instance (here WLinux) you only need to place a shell script which will start X410 and Tilix in Windows with no visible startup console:

#bin! zsh
Powershell.exe -Command 'start X410.exe /WM'
tmux new-session -s "Tilix" -n "Console" -d&
tmux send-keys -t Tilix "Display=:0 dbus-launch --exit-with-session tilix&" C-m

Take a look for a nice icon for the Windows link assigned in the properties of it and you are done.

Conclusion

I use this setup since a couple of month and I did't got any issue at all with it. No Bugs no performance issues. Most of the time I'm using Git, SpaceVim/NeoVim, TMux, SSH and other tools - and I'm happy with it (maybe I write another blog post about command-line-Tools, but you can get some inspiration from this awesome collection).

If you like to use my configurations feel free to copy my DotFiles repository on GitHub - but don't blame me for some more dirty hacks in there :wink:. You can also clone it with YADM - a DotFiles Manager I could recoment.

- CursorBeat.dev Blog