Restructure internal theme
This commit is contained in:
@@ -3,36 +3,37 @@ package registrar
|
||||
|
||||
import "os"
|
||||
import "log"
|
||||
import "git.tebibyte.media/tomo/backend/x"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
||||
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"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/theme/style/aluminum"
|
||||
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"
|
||||
|
||||
func Init () error {
|
||||
var theme *dataTheme.Theme
|
||||
var styl *style.Style
|
||||
// TODO eventually get rid of this when we make a file format for
|
||||
// storing visual styles
|
||||
if os.Getenv("TOMO_USE_ALUMINUM_STYLE") != "" {
|
||||
theme = aluminumStyle.New()
|
||||
styl = aluminumStyle.New()
|
||||
} else {
|
||||
theme = fallbackStyle.New()
|
||||
styl = fallbackStyle.New()
|
||||
}
|
||||
theme.IconTheme = fallbackIcons.New()
|
||||
icons := fallbackIcons.New()
|
||||
|
||||
iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME")
|
||||
if iconThemeName != "" {
|
||||
iconTheme, err := xdgIcons.FindThemeWarn(iconThemeName, theme.IconTheme)
|
||||
xdgIconTheme, err := xdgIcons.FindThemeWarn(iconThemeName, icons)
|
||||
if err == nil {
|
||||
theme.IconTheme = iconTheme
|
||||
icons = xdgIconTheme
|
||||
} else {
|
||||
log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err)
|
||||
}
|
||||
}
|
||||
|
||||
tomo.SetTheme(theme)
|
||||
tomo.SetStyle(styl)
|
||||
tomo.SetIcons(icons)
|
||||
tomo.Register(1, x.New)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user