4

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?

1

3 Answers 3

6

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.

8
  • 1
    This doesn't work for everything, as opening a folder to the terminal will ignore the path parameter. May 3, 2020 at 14:58
  • Unfortunately it always opens at default location... @LouisGarczynski, do you know how to make it handle the intial location?
    – MaciekS
    May 3, 2020 at 16:30
  • I've tried to set the command as /bin/zsh $1, which doesn't work at all. Looking up for the correct argument name has yielded no results May 3, 2020 at 23:24
  • 1
    Looked more into it, it looks like terminator doesn't pass the path to the shell. Checking with using 'printenv' as the custom command. Looks like it's chsh or nothing. May 4, 2020 at 0:00
  • Found a working solution, added it as an answer May 13, 2020 at 10:12
1

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.
1
  • This has the added benefit that any exports you have in your .bashrc will exist in your zsh session. It doesn't work for aliases though.
    – McAngus
    Mar 16, 2022 at 10:59
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .