1

Is it possible to set different shells for different desktop environments? (I know the risks/complications of multiple DEs.)

My underlying core system is Tumbleweed with KDE. For that system, I've got zsh set up with a fancy Powerline prompt.

But I've also been experimenting with i3 lately, and I'd like it to start with bash instead, with a smaller font and a more generic prompt.

Is this possible?

Thanks.

  • Woops, deleted my original answer. Saw you were talking about the shell and not the terminal emulator. If you want to change font, change that in your terminal though. – bgregs Dec 18 '18 at 13:12
  • Neat idea; I don't have i3 at hand, but I suspect you could put code in your shell's initialization file that checked parent processes for the existence of i3; if found, exec bash -il or similar. – Jeff Schaller Dec 18 '18 at 13:34
  • Maybe I am totally misreading it, but: are you using the same terminal emulator in both desktop environments? Which terminal emulator? – fra-san Dec 18 '18 at 13:37
  • I didn't mention it, but I was planning on keeping a terminal reserved for the "fancy graphics" DE like KDE, on which I can show the glyphs for OS type, a clock icon, etc. And dedicating a separate terminal (they're small apps and I've got lots of storage) just for i3. I can set any terminal app as default in i3, that's easy even for a newbie like me. It's the shell and all the ($PS1) formatting I'd like to change automagically. – Dito Dec 18 '18 at 14:34
1

Yes, it is possible.

But one user only has one set of default applications.
Sure, you can create a new user and ssh to it (ssh user2@localhost) and make the default shell of that user bash (or other) but that is probably not what you meant.

Then the rub lies on deciding what will trigger the use of one shell or another.

Simple

You can just type bash -l at the command prompt and start working with it.
Later (when/if needed) you can make this easier.

The -l option will ensure a clean set of environment variables and the use of default configuration files like /etc/bash.bashrc and ~/.bashrc.

Easy

The easiest way is to use a different console application (gnome-terminal, konsole, xterm, etc) and configure it to start the shell you want on start. Assuming that you use konsole in KDE, and i3-sensible-terminal is the default for i3, you can configure gnome-terminal to load bash on start and use gnome-terminal as your terminal. Go to Edit --> Profile Preferences --> Command --> Run a custom command instead of my shell --> Custom command --> bash -l.

Equivalent settings could be done with most other shell terminals.

Then it is just a matter of starting the related terminal to get either zsh or bash in any of the DM.

DM

If you have (or could install) wmctrl, then, this line will tell you which DM is currently running:

 wmctrl -m

From that, you can decide which profile to load in konsole:

 case $(wmctrl -m| grep 'Name:') in
     Name: i3)   konsole --profile i3    ;;
     Name: kde)  konsole --profile kde   ;;
 esac

Of course, you need to edit the configuration for each profile like font size, colors, etc.

  • Excellent. I'm the only user on this machine. (There's only one other person in the household and she most definitely does not speak Linux). I'll try getting it set up shortly. Thanks. – Dito Dec 18 '18 at 16:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.