• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Solved Changing default terminal from xterm to konsole

Geoff Crow

New Member

Thanks: 1
Messages: 2

#1
I have recently installed FreeBSD 11.1 on my HP laptop. I created a desktop launcher on the Mate desktop for neovim, and set the terminal option to true. When started neovim starts in xterm even though my preferred terminal is konsole. How can I change the default term to konsole?

Thanks in advance.
 

Sensucht94

Active Member

Thanks: 144
Messages: 182

#2
Edit the neovim desktop shortcut (should be something like ~/Desktop/NeoVim.desktop), and:
- replace line " Terminal=true" with " Terminal=false"
- replace line " Exec=nvim %F" with " Exec=konsole -e nvim %F

If you want changes to be applied globally, and not only for the shortcut in your desktop do the same for file /usr/local/share/applications/nvim.desktop, with root privileges

Whenever a CLI application is launched with " Terminal=true" (nvim, mutt, alpine, ranger, mc, irssi, newsbeuter, moc...) it invokes the $TERM environmental variable to get an identifier for the text window’s capabilities. By default $TERM is set to xterm (8 colors) identifier, and therefore CLI applications will launch xterm with support for 8 colors only. Changing the $TERM env variable by specifying another identifier, will affect both the terminal type and the terminal's aspects which CLI programs are launched with

Many modern terminals (Ex. GNOME Terminal) rely on the xterm-256 color identifier to set colors and many other parameters, but I have no clue about konsole

You can define the $TERM environmental variable for your current user inside~/.profile for all Bourne-Shell compatible shells, or inside ad-hoc configuration files: ~/.tcshrc, ~/.cshrc, ~/.zshrc, ~/.kshrc.....for the specific shell you use.

You can also change terminal dynamically for the current session. Syntax required to change an env variable, varies from shell to shell:

- in tcsh: setenv TERM <term_identifier>.... unsetenv to clear the vaule

- in csh : set TERM=<term_identifier>

- in bash and zsh: export TERM=<term_identifier>

- in fish: set -gx TERM <term_identifier>

The "term_identifier" does not necessary match the corresponding binary executable's name. For example, although RXvt-Unicode's executable is rxvt if I want to set my term type to RXvt-Unicode with 256 colors support in tcsh, I'd type:
setenv TERM rxvt-unicode-256color
or append the same line to .tchsrc.
This will make all my CLI apps be started inside rxvt with 256 colors support, and desktop shortcuts containing entry "Terminal=true" will do likewise. This will also affects the behavior of some other complex terminal emulatorsr

To confirm changes have been applied, display the current TERM definitions:
echo $TERM
Code:
rxvt-unicode-256color
All supported terminal definitions, with their options and identifiers, are listed inside /usr/share/misc/termcap and follow the terminfo(5) syntax. In my experience, for any compatible terminal installed, a new entry, whether taken from source or docs which came with the port, will be added at the bottom of that file, and you'd be able to look it up using tail(1). All available terminal identifiers can be listed using toe(1)...for example, to view all Eterm's identifiers:
toe -as | grep -i Eterm:

Code:
*-*-: Eterm Eterm Terminal Emulator (X11 Window System)
*---: Eterm-256color Eterm with xterm 256-colors
*---: Eterm-88color Eterm with 88 colors *---: screen-bce.Eterm screen optimized for Eterm
*---: screen.Eterm screen in Eterm
Now, since I'm pretty sure can't set Konsole as $TERM, you might want instead to look inside your default applications and put it as default terminal, or try making some aliases, then set $TERM the indentifier of your like, and it should affect the way text is displayed under Konsole as well
 

Geoff Crow

New Member

Thanks: 1
Messages: 2

#3
Edit the neovim desktop shortcut (should be something like ~/Desktop/NeoVim.desktop), and:
- replace line " Terminal=true" with " Terminal=false"
- replace line " Exec=nvim %F" with " Exec=konsole -e nvim %F

If you want changes to be applied globally, and not only for the shortcut in your desktop do the same for file /usr/local/share/applications/nvim.desktop, with root privileges

Whenever a CLI application is launched with " Terminal=true" (nvim, mutt, alpine, ranger, mc, irssi, newsbeuter, moc...) it calls the $TERM environmental variable to get an identifier for the text window’s capabilities. By default $TERM is set to xterm (8 colors) identifier, and therefore CLI applications will launch xterm with support for 8 colors only when launched. Changing the $TERM env variable by specifying another identifier, will affect both the terminal type and the terminal's aspects which CLI programs are launched with

Many modern terminals (Ex. GNOME Terminal) rely on the xterm-256 color identifier to set colors and many other parameters, but I have no clue about konsole

You can define the $TERM environmental variable for your current user inside~/.profile for all Bourne-Shell compatible shells, or inside ad-hoc configuration files: ~/.tcshrc, ~/.cshrc, ~/.zshrc, ~/.kshrc.....for the specific shell you use.

You can also change terminal dynamically for the current session. Syntax required to change an env variable, varies from shell to shell:

- in tcsh: setenv TERM <term_identifier>.... unsetenv to clear the vaule

- in csh : set TERM=<term_identifier>

- in bash and zsh: export TERM=<term_identifier>

- in fish: set -gx TERM <term_identifier>

The "term_identifier" does not necessary match the corresponding binary executable's name. For example, although RXvt-Unicode's executable is rxvt if I want to set my term type to RXvt-Unicode with 256 colors support in tcsh, I'd type:
setenv TERM rxvt-unicode-256color
or append the same line to .tchsrc.
This will make all my CLI apps be started inside rxvt with 256 colors support, and desktop shortcuts containing entry "Terminal=true" will do likewise. This will also affects the behavior of some other complex terminal emulators

All supported terminal definitions, with their options and identifiers, are listed inside /usr/share/misc/termcap and follow the terminfo(5) syntax. In my experience, for any compatible terminal installed, a new entry, whether taken from source of docs which came with the port, will be added at the bottom of that file, and you'd be able to look it up using tail(1). All available terminal identifiers can be listed using toe(1)...for example, to view all Eterm's identifiers:
toe -as | grep -i Eterm:

Code:
*-*-: Eterm Eterm Terminal Emulator (X11 Window System)
*---: Eterm-256color Eterm with xterm 256-colors
*---: Eterm-88color Eterm with 88 colors *---: screen-bce.Eterm screen optimized for Eterm
*---: screen.Eterm screen in Eterm
Now, since you can't set Konsole as $TERM, you might want instead to look inside your default applications and put it as default terminal, or try making some aliases

sensucht94
thank you for the comprehensive answer. I changed the desktop launcher as you suggested and it works as I wanted.
Now how do I mark this as "solved"