mirror of
https://github.com/Xevion/glance.git
synced 2025-12-14 18:11:54 -06:00
Add Dashboard Icons prefix support
- defined new type IconSource and constants, presently supporting: - LocalFile - SimpleIcon - DashboardIcon - added new field to bookmarks and monitors to hold IconSource - adjusted IsSimpleIcon to get truthiness from IconSource field - generalised `toSimpleIconIfPrefixed` into `toRemoteResourceIconIfPrefixed`, adding support for `walkxcode`'s dashboard icons via CDN (svg)
This commit is contained in:
@@ -13,12 +13,13 @@ type Bookmarks struct {
|
||||
Title string `yaml:"title"`
|
||||
Color *HSLColorField `yaml:"color"`
|
||||
Links []struct {
|
||||
Title string `yaml:"title"`
|
||||
URL string `yaml:"url"`
|
||||
Icon string `yaml:"icon"`
|
||||
IsSimpleIcon bool `yaml:"-"`
|
||||
SameTab bool `yaml:"same-tab"`
|
||||
HideArrow bool `yaml:"hide-arrow"`
|
||||
Title string `yaml:"title"`
|
||||
URL string `yaml:"url"`
|
||||
Icon string `yaml:"icon"`
|
||||
IsSimpleIcon bool `yaml:"-"`
|
||||
IconSource IconSource `yaml:"-"`
|
||||
SameTab bool `yaml:"same-tab"`
|
||||
HideArrow bool `yaml:"hide-arrow"`
|
||||
} `yaml:"links"`
|
||||
} `yaml:"groups"`
|
||||
}
|
||||
@@ -33,7 +34,8 @@ func (widget *Bookmarks) Initialize() error {
|
||||
}
|
||||
|
||||
link := &widget.Groups[g].Links[l]
|
||||
link.Icon, link.IsSimpleIcon = toSimpleIconIfPrefixed(link.Icon)
|
||||
link.Icon, link.IconSource = toRemoteResourceIconIfPrefixed(link.Icon)
|
||||
link.IsSimpleIcon = link.IconSource == SimpleIcon
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user