From ddd120178db71f70277a73eb96c54e8f2128106f Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Mon, 10 Jun 2024 16:12:07 +0200 Subject: [PATCH] feat(font): reload font cache on unix systems --- src/font/install.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/font/install.go b/src/font/install.go index 9aff5d1f5e92..450286df6072 100644 --- a/src/font/install.go +++ b/src/font/install.go @@ -7,7 +7,11 @@ import ( "bytes" "io" "path" + "runtime" "strings" + + "github.com/jandedobbeleer/oh-my-posh/src/platform" + "github.com/jandedobbeleer/oh-my-posh/src/platform/cmd" ) func contains[S ~[]E, E comparable](s S, e E) bool { @@ -69,5 +73,10 @@ func InstallZIP(data []byte, user bool) ([]string, error) { } } + // Update the font cache when installing fonts on Linux + if runtime.GOOS == platform.LINUX || runtime.GOOS == platform.DARWIN { + _, _ = cmd.Run("fc-cache", "-f") + } + return families, nil }