2024-05-03 16:46:09 +00:00
|
|
|
//go:build unix && (!darwin)
|
2024-05-07 03:25:25 +00:00
|
|
|
package registrar
|
2024-04-29 20:21:53 +00:00
|
|
|
|
2024-05-29 01:56:52 +00:00
|
|
|
import "os"
|
|
|
|
import "log"
|
2024-06-03 07:04:29 +00:00
|
|
|
import "git.tebibyte.media/tomo/backend/x"
|
2024-04-29 20:21:53 +00:00
|
|
|
import "git.tebibyte.media/tomo/tomo"
|
2024-06-03 07:48:13 +00:00
|
|
|
import dataTheme "git.tebibyte.media/tomo/nasin/internal/theme"
|
2024-06-03 07:04:29 +00: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-06-03 07:48:13 +00:00
|
|
|
import "git.tebibyte.media/tomo/nasin/internal/theme/style/aluminum"
|
2024-04-29 20:21:53 +00:00
|
|
|
|
2024-05-03 16:46:09 +00:00
|
|
|
func Init () error {
|
2024-06-03 07:48:13 +00:00
|
|
|
var theme *dataTheme.Theme
|
|
|
|
// 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()
|
|
|
|
} else {
|
|
|
|
theme = fallbackStyle.New()
|
|
|
|
}
|
|
|
|
theme.IconTheme = fallbackIcons.New()
|
2024-05-29 01:56:52 +00:00
|
|
|
|
|
|
|
iconThemeName := os.Getenv("TOMO_XDG_ICON_THEME")
|
|
|
|
if iconThemeName != "" {
|
2024-05-29 02:13:42 +00:00
|
|
|
iconTheme, err := xdgIcons.FindThemeWarn(iconThemeName, theme.IconTheme)
|
2024-05-29 01:56:52 +00:00
|
|
|
if err == nil {
|
|
|
|
theme.IconTheme = iconTheme
|
|
|
|
} else {
|
|
|
|
log.Printf("nasin: could not load icon theme '%s': %v", iconThemeName, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tomo.SetTheme(theme)
|
2024-06-03 07:04:29 +00:00
|
|
|
tomo.Register(1, x.New)
|
2024-05-03 16:46:09 +00:00
|
|
|
return nil
|
2024-04-29 20:21:53 +00:00
|
|
|
}
|