Last active
December 13, 2024 15:39
-
-
Save romkatv/aa7a70fe656d8b655e3c324eb10f6a8b to your computer and use it in GitHub Desktop.
Install Meslo Powerline font family on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This script installs patched Meslo Powerline font family on Windows. | |
# The fonts are installed for the current user only. The script must be | |
# run from WSL. | |
# | |
# bash -c "$(curl -fsSL https://gist.githubusercontent.com/romkatv/aa7a70fe656d8b655e3c324eb10f6a8b/raw/install_meslo_wsl.sh)" | |
# | |
# If you just want the font files, they are in | |
# https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts. | |
set -ueEo pipefail | |
function install_fonts() { | |
local dst_dir | |
dst_dir=$(wslpath $(cmd.exe /c "echo %LOCALAPPDATA%\Microsoft\\Windows\\Fonts" 2>/dev/null | sed 's/\r$//')) | |
mkdir -p "$dst_dir" | |
local src | |
for src in "$@"; do | |
local file=$(basename "$src") | |
test -f "$dst_dir/$file" || cp -f "$src" "$dst_dir/" | |
local win_path | |
win_path=$(wslpath -w "$dst_dir/$file") | |
# Install font for the current user. It'll appear in "Font settings". | |
reg.exe add \ | |
"HKCU\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts" \ | |
/v "${file%.*} (TrueType)" /t REG_SZ /d "$win_path" /f 2>/dev/null | |
done | |
} | |
function main() { | |
local repo | |
repo="$(mktemp -d)" | |
trap "rm -rf ${repo@Q}" INT TERM EXIT | |
git clone https://github.com/romkatv/dotfiles-public.git "$repo" | |
install_fonts "$repo"/.local/share/fonts/NerdFonts/*.ttf | |
} | |
main | |
echo -e '\033[0;32m' | |
echo 'Fonts successfully installed.' | |
echo '' | |
echo 'To change font in Windows Console Host (the old thing):' | |
echo ' Right click on the window title -> Properties -> Font and set Font' | |
echo ' to "MesloLGS NF".' | |
echo '' | |
echo 'To change font in Windows Terminal (the new thing):' | |
echo ' Open Settings (Ctrl+,), search for "fontFace" and set value' | |
echo ' to "MesloLGS NF" for every profile.' | |
echo -e '\033[0m' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I just did a fresh install of win11 24H2 to a new drive. Another gotcha that I ran into for windows terminal.. MAKE SURE THIS IS OFF for all profiles/default where you plan to use before running p10k configure..
Also the ?3 meaning untracked files... I missed. Thought it was another prob.. thx to those who clarified :P Lost hours.