nasin/internal/registrar/registrar_unix.go

33 lines
844 B
Go
Raw Normal View History

//go:build unix && (!darwin)
2024-05-06 21:25:25 -06:00
package registrar
2024-04-29 14:21:53 -06:00
import "os"
import "log"
2024-06-03 01:04:29 -06:00
import "git.tebibyte.media/tomo/backend/x"
2024-04-29 14:21:53 -06:00
import "git.tebibyte.media/tomo/tomo"
2024-06-03 01:04:29 -06:00
import "git.tebibyte.media/tomo/nasin/internal/theme/icons/xdg"
import "git.tebibyte.media/tomo/nasin/internal/theme/icons/fallback"
import "git.tebibyte.media/tomo/nasin/internal/theme/style/fallback"
2024-04-29 14:21:53 -06:00
func Init () error {
2024-06-03 01:04:29 -06:00
theme := fallbackStyle.New()
iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME")
if iconThemeName != "" {
iconTheme, err := xdgIcons.FindThemeWarn(iconThemeName, theme.IconTheme)
if err == nil {
theme.IconTheme = iconTheme
} else {
log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err)
}
}
2024-06-03 01:04:29 -06:00
if theme.IconTheme == nil {
theme.IconTheme = fallbackIcons.New()
}
tomo.SetTheme(theme)
2024-06-03 01:04:29 -06:00
tomo.Register(1, x.New)
return nil
2024-04-29 14:21:53 -06:00
}