forked from deanishe/alfred-firefox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathicons.go
49 lines (42 loc) · 1.53 KB
/
icons.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2020 Dean Jackson <deanishe@deanishe.net>
// MIT Licence applies http://opensource.org/licenses/MIT
package main
import aw "github.com/deanishe/awgo"
var (
iconAddon = &aw.Icon{Value: "icons/addon.png"}
iconBookmark = &aw.Icon{Value: "icons/bookmark.png"}
iconBookmarklet = &aw.Icon{Value: "icons/bookmarklet.png"}
iconDocs = &aw.Icon{Value: "icons/docs.png"}
iconError = &aw.Icon{Value: "icons/error.png"}
iconHistory = &aw.Icon{Value: "icons/history.png"}
iconIncognito = &aw.Icon{Value: "icons/incognito.png"}
iconInstall = &aw.Icon{Value: "icons/install.png"}
iconIssue = &aw.Icon{Value: "icons/issue.png"}
iconMore = &aw.Icon{Value: "icons/more.png"}
iconScript = &aw.Icon{Value: "icons/script.png"}
iconTab = &aw.Icon{Value: "icons/tab.png"}
iconUpdateAvailable = &aw.Icon{Value: "icons/update-available.png"}
iconUpdateOK = &aw.Icon{Value: "icons/update-ok.png"}
iconURL = &aw.Icon{Value: "icons/url.png"}
iconWarning = &aw.Icon{Value: "icons/warning.png"}
// populated by loadURLActions
scriptIcons = map[string]*aw.Icon{}
imageExts = map[string]bool{
".png": true,
".jpg": true,
".jpeg": true,
".gif": true,
".icns": true,
}
)
func init() {
aw.IconError = iconError
aw.IconWarning = iconWarning
}
// return custom icon or fallback
func actionIcon(name string, fallback *aw.Icon) *aw.Icon {
if icon, ok := scriptIcons[name]; ok {
return icon
}
return fallback
}