From 072eaa602909cfb2dd2e6cb09bd6e549173793c8 Mon Sep 17 00:00:00 2001 From: Sasha Koshka Date: Tue, 28 May 2024 21:56:52 -0400 Subject: [PATCH] XDG icon themes can be loaded by setting $TOMO_XDG_ICON_THEME --- internal/registrar/registrar_unix.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/internal/registrar/registrar_unix.go b/internal/registrar/registrar_unix.go index 498d486..a28fa8c 100644 --- a/internal/registrar/registrar_unix.go +++ b/internal/registrar/registrar_unix.go @@ -1,12 +1,27 @@ //go:build unix && (!darwin) package registrar +import "os" +import "log" import "git.tebibyte.media/tomo/x" import "git.tebibyte.media/tomo/tomo" import "git.tebibyte.media/tomo/nasin/internal/theme/default" +import "git.tebibyte.media/tomo/nasin/internal/theme/xdgicons" func Init () error { - tomo.SetTheme(defaultTheme.Theme()) + theme := defaultTheme.Theme() + + iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME") + if iconThemeName != "" { + iconTheme, err := xdgIcons.FindThemeWarn(iconThemeName) + if err == nil { + theme.IconTheme = iconTheme + } else { + log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err) + } + } + + tomo.SetTheme(theme) tomo.Register(1, x.NewBackend) return nil }