nasin/internal/registrar/registrar_unix.go

40 lines
1.1 KiB
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-04-29 14:21:53 -06:00
import "git.tebibyte.media/tomo/tomo"
2024-06-11 22:19:12 -06:00
import "git.tebibyte.media/tomo/backend/x"
import "git.tebibyte.media/tomo/nasin/internal/style"
import "git.tebibyte.media/tomo/nasin/internal/icons/xdg"
import "git.tebibyte.media/tomo/nasin/internal/icons/fallback"
import "git.tebibyte.media/tomo/nasin/internal/style/fallback"
import "git.tebibyte.media/tomo/nasin/internal/style/aluminum"
2024-04-29 14:21:53 -06:00
func Init () error {
2024-06-11 22:19:12 -06:00
var styl *style.Style
2024-06-03 01:48:13 -06:00
// TODO eventually get rid of this when we make a file format for
// storing visual styles
if os.Getenv("TOMO_USE_ALUMINUM_STYLE") != "" {
2024-06-11 22:19:12 -06:00
styl = aluminumStyle.New()
2024-06-03 01:48:13 -06:00
} else {
2024-06-11 22:19:12 -06:00
styl = fallbackStyle.New()
2024-06-03 01:48:13 -06:00
}
2024-06-11 22:19:12 -06:00
icons := fallbackIcons.New()
iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME")
if iconThemeName != "" {
2024-06-11 22:19:12 -06:00
xdgIconTheme, err := xdgIcons.FindThemeWarn(iconThemeName, icons)
if err == nil {
2024-06-11 22:19:12 -06:00
icons = xdgIconTheme
} else {
log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err)
}
}
2024-06-11 22:19:12 -06:00
tomo.SetStyle(styl)
tomo.SetIcons(icons)
2024-06-03 01:04:29 -06:00
tomo.Register(1, x.New)
return nil
2024-04-29 14:21:53 -06:00
}