You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
I have a working setup on most machines, but occasionally I have to SSH to one of my machine from a different machine (from some random Windows computer, from my mobile phone, ...) and I cannot install fonts there. Can I check if fonts are installed in .zshrc?
If yes, it would be possible to configure a fallback way for the powerlevel9k config which does look fine also without special fonts installed.
Note: Don't confuse with the fallback-strategy for fonts, I am talking about a fallback .zshrc config.
Unfortunately we haven't found a way to automatically detect fonts yet. At least no proper reliable way. Neofetch does font detection of the terminal. And we adopted that solution for debugging purposes. But these solutions try to get that information from your terminal (as this is the program that uses the set font to display) and it won't detect a putty terminal..
So, you could set an env variable when connecting with putty and use that to switch your config.
That's bad and good news at the same time. Your hint with env variables helped to find a way to achieve what I need. It's quite hackish, but works for me - maybe for others with the same problem too. Thanks!
I've added the code in this commit lumbric/dot-file-repo@a39cd84 to my dot file repository. If anyone wants to copy it.
Basically the idea is that wherever my dot file repository and my .zshrc is in use, I will also have correct fonts installed. When SSH-ing from a client without my environment into a server with my environment, I can detect this by setting a env variable in my .zshrc and in this case load a fallback zsh theme or remove undisplayable symbols (that's what I did).
Env variables with names LC_* are passed automatically from client to server by default in OpenSS. This is meant for passing the locale to the server, but we can use it as others have done before. Look for these lines in your /etc/ssh/sshd_config:
# Allow client to pass locale environment variables
AcceptEnv LANG LC_*
On server side LC_CLIENT_HAS_DOT_FILE_REPO is never set explicitely (only via SSH), on client side it is obviously only run if .zshrc is executed. This means if the variable is not set, a fallback theme can be loaded:
source~/.dot-file-repo/zsh/powerlevel9k_settings.sh
# Fall back mode for powerlevel9k when SSH-ing to server with dot-file-repo and# powerlevel9k installed, but dot-file-repo and fonts not available on client.if [ -z$SSH_CLIENT ];then# this env variable will be available only if this .zshrc is used on clientexport LC_CLIENT_HAS_DOT_FILE_REPO=1
fiif [ -z$LC_CLIENT_HAS_DOT_FILE_REPO ];thensource~/.dot-file-repo/zsh/powerlevel9k_settings_no_font_fallback.sh
fi
I did something very cheap, I simply disabled all broken features until it looked good enough:
One could also try to find symbols supported with normal fonts or load a standard zsh theme. Please let me know if you have suggestions how to imrpove this part of my config and make the fallback more beautiful!
I have a working setup on most machines, but occasionally I have to SSH to one of my machine from a different machine (from some random Windows computer, from my mobile phone, ...) and I cannot install fonts there. Can I check if fonts are installed in .zshrc?
If yes, it would be possible to configure a fallback way for the powerlevel9k config which does look fine also without special fonts installed.
Note: Don't confuse with the fallback-strategy for fonts, I am talking about a fallback .zshrc config.
See also: #436 #253
The text was updated successfully, but these errors were encountered: