Documentation ¶
Index ¶
- Variables
- func ConvertICOtoPNG(ico []byte) (png []byte, err error)
- func GenerateBinaryNameFromPath(path string) string
- func GetProfileIcon(name string) (data []byte, err error)
- func IgnoreIcon(name string) bool
- func UpdateProfileIcon(data []byte, ext string) (filename string, err error)
- type Icon
- type IconInDatabase
- type IconLocation
- type IconLocationType
- type IconSource
- type IconType
- type PathArg
Constants ¶
This section is empty.
Variables ¶
var ErrIconIgnored = errors.New("icon is ignored")
ErrIconIgnored is returned when the icon should be ignored.
var ProfileIconStoragePath = ""
ProfileIconStoragePath defines the location where profile icons are stored. Must be set before anything else from this package is called. Must not be changed once set.
Functions ¶
func ConvertICOtoPNG ¶
ConvertICOtoPNG converts a an .ico to a .png image.
func GenerateBinaryNameFromPath ¶
GenerateBinaryNameFromPath generates a more human readable binary name from the given path. This function is used as fallback in the GetBinaryName functions.
func GetProfileIcon ¶
GetProfileIcon returns the profile icon with the given ID and extension.
func IgnoreIcon ¶ added in v1.6.8
IgnoreIcon returns whether an icon should be ignored or not.
Types ¶
type Icon ¶
type Icon struct { Type IconType Value string Source IconSource }
Icon describes an icon.
func GetIconAndName ¶
func GetIconAndName(ctx context.Context, binPath string, homeDir string) (icon *Icon, name string, err error)
GetIconAndName returns an icon and name of the given binary path. Providing the home directory of the user running the process of that binary can improve results. Even if an error is returned, the other return values are valid, if set.
func LoadAndSaveIcon ¶
LoadAndSaveIcon loads an icon from disk, updates it in the icon database and returns the icon object.
func SortAndCompactIcons ¶
SortAndCompactIcons sorts and compacts a list of icons.
func (Icon) GetIconAsDataURL ¶
GetIconAsDataURL returns the icon data as a data URL.
type IconInDatabase ¶
type IconInDatabase struct { sync.Mutex record.Base IconData string `json:"iconData,omitempty"` // DataURL }
IconInDatabase represents an icon saved to the database.
func EnsureIconInDatabase ¶
func EnsureIconInDatabase(r record.Record) (*IconInDatabase, error)
EnsureIconInDatabase ensures that the given record is a *IconInDatabase, and returns it.
type IconLocation ¶
type IconLocation struct { Directory string Type IconLocationType PathArg PathArg }
IconLocation describes an icon location.
type IconLocationType ¶
type IconLocationType uint8
IconLocationType describes an icon location type.
const ( FlatDir IconLocationType = iota XDGIcons )
Icon Location Types.
type IconSource ¶
type IconSource string
IconSource describes the source of an Icon.
const ( IconSourceUser IconSource = "user" IconSourceImport IconSource = "import" IconSourceUI IconSource = "ui" IconSourceCore IconSource = "core" )
Supported icon sources.