XDG icon themes can be loaded by setting $TOMO_XDG_ICON_THEME

This commit is contained in:
Sasha Koshka 2024-05-28 21:56:52 -04:00
parent 7d9d93fa3f
commit 072eaa6029

View File

@ -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
}