Change default shell from bash to zsh by default?

All of this is now in the developers repository.


Two issues…

  1. inconsistent ZDOTDIR environment variable
  • bug: With lightdm display manager (on my Debian host operating system + distro morphed into Kicksecure): ZDOTDIR environment variable missing
  • ok: Whonix Xfce for VirtualBox which is using gdm display manager: ZDOTDIR environment variable ok
  • ok: virtual consoles

Seems like DefaultEnvironment= isn’t as consistent / reliable as desired.

  1. changing default shell is failing in Whonix Xfce for VirtualBox

debian/dist-base-files.postinst command chsh --shell /bin/zsh user is failing due to permission denied (seen during apt dist-upgrade). (The chsh command doesn’t require sudo because Debian maintainer scripts run as root anyhow.)

:frowning:

I don’t know any reliable way of setting system wide variables before the shell is sourced.
Last resort would be to patch the /etc/zsh scripts provided by debian, which I understand is also undesired.

If for example the variable was set in the zsh system files, then it would not need to be set externally, only will be used by zsh sourcing.

1 Like

Issues:

  • POS1 key not working
  • END key not working

fixing

1 Like

You can use POS1 or ENDE or Ctrl+A and Ctrl+E for the same functionality.

See the bindkeys section for a lot of things that can be done with the control keys.

1 Like

Excellent! Merged. Thank you!

Currently I had the very same question:

The answer there worked for me. First I typed in the zsh shell:

bindkey '^ ' forward-word

This was handy to test this so I didn’t have to edit the zsh config right away just to try that solution. Once entered, I could use

ctrl + space

Now, before we add bindkey '^ ' forward-word to the zsh config by default… Are there some common / popular / convention zsh shortcuts? Then perhaps we should use the same instead of inventing ones which are only used by Kicksecure / Whonix?

Once that’s done, the most common hotkeys should be documented unless it’s already documented somewhere good enough upstream.

Readline library is what shells uses. Every shell has their own implementation, Zsh used Bash readline in the beginning then startd doing their own version.

Bash reads /etc/inputrc and ~/.inputrc, Zsh does not.

As for typing style, Vi-style line editor is POSIX while Emacs is not.

Zsh does not have default keybindings, it comes clean and you design your keybindings, but it is better to follow preexisting standards:

https://man.archlinux.org/man/readline.3#DEFAULT_KEY_BINDINGS
https://manpages.debian.org/bullseye/readline-common/readline.3readline.en.html

A good table I found is in the Arch Wiki.

The debian man page also has the table, but it is just a little bit more difficult to read without colors and column separation.
Order of precedence I will be using:

  • if Vi and Emacs keymap is empty, I will try to choose a non-used key
  • if one of the styles is empty, I will use the other style key.
  • if both are filled, I will prefer Vi because it is POSIX and not GNU only.
1 Like

Another thing is that some controls, even not specified on the zsh file, are acting their default behavior.

Example is ^I, which is the same as tab. I will add those also because then I don’t overwrite the default behavior they already have with different mappings.

Edit: some can’t be mentioned

zsh-syntax-highlighting: unhandled ZLE widget 'complete'
zsh-syntax-highlighting: (This is sometimes caused by doing `bindkey <keys> complete` without creating the 'complete' widget with `zle -N` or `zle -C`.)
``
1 Like

Now, before we add bindkey '^ ' forward-word to the zsh config by default

Didn’t find anything conflicting with ^ .

Are there some common / popular / convention zsh shortcuts? Then perhaps we should use the same instead of inventing ones which are only used by Kicksecure / Whonix?

Doing that following the readline man page (Arch or Debian, same thing)

Once that’s done, the most common hotkeys should be documented unless it’s already documented somewhere good enough upstream.

Just link to man page.

One default behavior I know that I changed is ^J to accept-search instead of the default accept-line.

^M is already accept-line, which equals to the Enter key.

Having ^J as accept-search is better for tab completion, you can select the option and type ^J to accept the search and continue typing.

1 Like
1 Like

Forward word and backward word is not Ctrl+arrows, where arrows are right and left arrows.

1 Like

I think this is the right way to go. macOS did this some time ago, but not for this reason.

Maybe with different colors/themes (I kinda like compartmentalization) in Whonix GW vs Whonix WS too, once again to prevent mistakes from happens, because they do, right?

Have a good one! // yodawins

1 Like

Currently the prompt is workstation|gateway user PWD, where workstation or gateway depends on the vm you are on. I see a problem with this is that it makes the prompt too large, but ws|gw would not be a suitable alternative because they only differ by one letter. Maybe setting the terminal background differently for the GW or WS would help, but that would be on XFCE, not on ZSH.

1 Like

Merged, thank you!

1 Like

Thanks, merged!

Another issue:
The ZDOTDIR environment variable is unset when logging in over SSH.

Results in…


Something useful here that we don’t have yet…?