Closed Teknitix closed 5 years ago
@Teknitix
Which terminal emulator do you use? Primarily Tilix and Konsole, but the issue is with Manjaro's built-in tty (when pressing Ctrl-Alt-Fn keys
You mean Ctrl-Alt-F2 for example? This probably is a font problem, you need to install a patched font in the tty as well or rather activate a powerline-patched font when you're logged in.
Nerd-Fonts is not compatible with the tty (at least last time I tried it wasn't)
Edit:
Also, take a look at this on setting the tty font https://wiki.archlinux.org/index.php/Fonts#Changing_the_default_font
You're using Manjaro which is arch-based so everything described there should work
I have at the top of .zshrc a export TERM='xterm-256color'.
TERM
is set by your terminal so that your shell (and scripts within the shell) can know which terminal is being used. It's almost never a good idea to set TERM
in .zshrc
.
To figure out a solution, please remote the TERM
override from .zshrc
, log into Mojaro and type the following:
zmodload zsh/terminfo
typeset TERM COLORTERM
echo ${terminfo[colors]}
What's the output?
@sambadevi: Thanks for your response. Yes, it's when pressing Ctrl-Alt-F2 as you suspected.
I have a powerline-patched font installed via the powerline patched font package in Manjaro's repositories, and I also installed several NERD Patched Fonts from GitHub. I went through the website you sent me and it details how to install a font, which I did, but I didn't see anything that talked about changing the default tty font. What would I put in an automation script to 'activate' a powerline-patched font when logging into the tty?
http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x721.html I found this small lead on how to detect a tty session: In Tilix or Konsole it lists 'pts/#' and on Manjaro's tty it lists 'tty#', but I'm not sure what to write to get the condition to do what is needed to either activate the font in a tty or get it to reduce to a simple prompt.
@romkatv : Thank you for the tip. I made the correction by taking out the export to TERM line. That actually solved the issue, and on going into a tty it now reduces down to a simple %_
prompt without the distortions in the previous image.
Here is the output of those commands:
TERM=xterm-256color
COLORTERM=truecolor
256
But on the tty, the output is:
TERM=linux
8
Setting that variable in the script appears to be exactly what was wrong. Where can I find more definitive information about the TERM variable and terminal colors, so that I can really nail this down conceptually and understand how it works? What should I do to understand 256 colors vs 8 colors, etc?
Thanks once again I really appreciate all your help, this was a big help.
@Teknitix Thanks for the info. Now it makes sense.
I don't know where you can find info on TERM
but it's really simple. Your terminal is a process that spawns shell as its child process. It sets TERM
environment variable so that the shell knows which terminal is in use. xterm
in TERM
means the terminal is a graphical application. When you are logged into Mojaro, you cannot run graphical applications, so TERM
doesn't contain xterm
.
Fonts that you've installed in your desktop environment are of no use in Mojaro. They can only be used by graphical applications. That is, only by terminals that have xterm
in their TERM
variable.
The terminal you get without graphics is rather primitive. It only supports 8 colors and has no way to utilize custom fonts. That's just the way it is.
To deal with this problem your theme must be capable of providing decent prompt even when your terminal isn't graphical and doesn't support 256 colors. As it happens, there is a configuration file for Powerlevel9k/Powerlevel10k called Pure Power that fits the bill. You can try it like so:
( cd && curl -fsSLO https://raw.githubusercontent.com/romkatv/dotfiles-public/master/.purepower )
Then put the following before sourcing your theme (e.g., at the top of ~/.zshrc
will work):
[[ $TERM != xterm* ]] && : ${PURE_POWER_MODE:=portable}
PURE_POWER_USE_P10K_EXTENSIONS=0 # you can remove this if using p10k
source ~/.purepower
~/.purepower
isn't a theme. It just defines configuration options for Powerlevel9k/Powerlevel10k. It works in graphical and dumb terminals and doesn't require patched fonts. It also looks great. It'll completely change your prompt though. You can either modify ~/.purepower
to suit your needs, or borrow the ideas from ~/.purepower
to make your own prompt style work with non-graphical terminals.
P.S.
Pure Power works both with Powerlevel9k and Powerlevel10k. The latter renders the same prompt (not just with Pure Power config but with any config) but much faster.
Thanks a lot for the information about PowerPure; I gave PurePower a try -- Thank you for making Powerlevel10k, which is amazing!
I hope you'll be able to help me with this issue.
Describe Your Issue
What is happening? PowerLevel9k works normally in zsh in Konsole. However, when I open the built-in tty on Manjaro (Ctrl-Alt-F2) and log in, I get a reduced version of powerlevel 9k that obscures the prompts (as shown in the 'screenshot'/picture taken). My .zshrc is fairly straightforward with nothing that really deviates from the examples here on GitHub.
What I want to happen: I want to be able to detect that it's in a tty session and change the prompt to one that is more simple (or just switch to the vanilla zsh prompt).
Picture: https://upload.vaa.red/2bWA29#8f4ef2ae6b813e76c7865ec955f325f5 As you can see, on Manjaro's built-in tty my two-line prompt is reduced to just green and blue blocks. How can I get this to reduce down to a simple prompt or just go to a zsh prompt if it detects it's in Manjaros' tty session?
Have you tried to debug or fix it?
echotc Co
returns256
in both a terminal and in the tty session. (I have at the top of .zshrc aexport TERM='xterm-256color'
.) I tried several strategies here https://unix.stackexchange.com/questions/26676 and discovered both Manjaro's built-in tty and Konsole and other terminals are interactive.No solution found after searching online, searching PowerLevel9k's GitHub issues, or searching the Manjaro Forum (https://forum.manjaro.org/).
Environment Information
This information will help us understand your configuration.
What version of ZSH are you using? You can use
zsh --version
to see this. zsh 5.7.1 (x86_64-pc-linux-gnu)Do you use a ZSH framework (e.g., Oh-My-ZSH, Antigen)? Prezto with zplug I have placed in bash:
How did you install P9k (cloning the repo, by tarball, a package from your OS, etc.,)? By using zplug in .zshrc My .zshrc is fairly straightforward with nothing that really deviates from the examples here on GitHub.
What version of P9k are you using? The latest
Which terminal emulator do you use? Primarily Tilix and Konsole, but the issue is with Manjaro's built-in tty (when pressing Ctrl-Alt-Fn keys