-
Notifications
You must be signed in to change notification settings - Fork 1
/
icns.js
39 lines (36 loc) · 913 Bytes
/
icns.js
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
const alfy = require('alfy');
const icons = require('../assets/icons.json');
const getTitle = (icon = '') => {
let title = icon;
title = title.replace('Icon', '');
title = title.replace('com.apple.', '');
title = title.replace('Sidebar', '');
return title;
};
const items = alfy
.inputMatches(icons, 'title')
.map(element => ({
title: getTitle(element),
subtitle: 'Paste icon name',
arg: element,
icon: {
path: alfy.icon.get(element)
},
mods: {
alt: {
arg: `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/${element}.icns`,
subtitle: 'Paste full path'
},
shift: {
arg: `/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/${element}.icns`,
subtitle: 'Open in preview'
},
cmd: {
subtitle: 'Paste alfy icon object',
arg: `icon: {
path: alfy.icon.get('${element}')
},`
}
}
}));
alfy.output(items);