How to set zsh as default for gnome terminal only?

I have configured my account to use zsh as default shell -with one of the helpful Oh-my-zsh themes. The theme requires some special fonts and rich colour scale. When I switch to terminal (e.g. by Ctrl+Alt+Fn) or use some limited terminal emulator (e.g. embedded in IDE) it causes problems due to limited colourscale or fixed font.

How can I set the zsh with oh-my-zsh theme default only for gnome-terminal, so that the bash will remain the default one?

Asked By: MaciekS

||

Based on the instruction from @steeldriver ‘s comment (sorry, I can’t upvote):

  1. open the preferences (right click in the window or use the hamburger button)
  2. go to configuration profile (I created a new one for ZSH by cloning the default)
  3. select “Command” tab
  4. tick “Run a custom command instead of my shell.” option
  5. write “zsh” in “Custom command” textbox

That’s it. Next time you start Terminal it opens with zsh.

Answered By: MaciekS

While the other answer works, if you want to keep some of the other features, such as opening a folder in terminal, or having the terminal remember the last paths, you can try adding this as the first line to your .bashrc:

[ -n "$GNOME_TERMINAL_SCREEN" ] && [ -x "$(command -v zsh)" ] && exec zsh "$@"
  • [ -n "$GNOME_TERMINAL_SCREEN" ] checks for the GNOME Terminal.
  • [ -x "$(command -v zsh)" ] checks if zsh exists.
  • exec zsh "$@" starts zsh with the same argument as bash.
Answered By: Louis Garczynski

As @MaciekS’s answer, in current terminal window, then right-click, select the "Preferences" tab, then in the new open window select "Profile",then select the top bar tab "Command", then you’ll get an image like below.

Profile tab:

profile tab

Finally, in the textbox "Custom Command" area, input "zsh", then open a new terminal, and you will find it has worked.

Answered By: ling g
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.