Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for scalable icons #104

Merged
merged 1 commit into from
Sep 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,12 @@ Or multiple images with their corresponding resolutions:
'48x48': 'resources/Icon48.png',
'64x64': 'resources/Icon64.png',
'128x128': 'resources/Icon128.png',
'256x256': 'resources/Icon256.png'
'256x256': 'resources/Icon256.png',
'scalable': 'resources/Icon.svg'
}
}
```
Note that the image files must be one of the types: PNG or SVG. The support for SVG works only on `scalable` resolution.

#### options.categories
Type: `Array[String]`
Expand Down
7 changes: 6 additions & 1 deletion src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,12 @@ var createPixmapIcon = function (options, dir, callback) {
*/
var createHicolorIcon = function (options, dir, callback) {
async.forEachOf(options.icon, function (icon, resolution, callback) {
var iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', options.name + '.png')
var iconFile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should start using let.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, but I think that should be different PR since var is used everywhere right now

if (resolution === 'scalable') {
iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', options.name + '.svg')
} else {
iconFile = path.join(dir, 'usr/share/icons/hicolor', resolution, 'apps', options.name + '.png')
}
options.logger('Creating icon file at ' + iconFile)

mkdirp(path.dirname(iconFile), '0755', function (err, made) {
Expand Down
Loading