Skip to content

Commit

Permalink
Filter out unsupported SVG icons on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
filips123 committed Mar 20, 2024
1 parent 9a1773a commit facdfda
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ function buildIconList (icons, purpose = 'any') {
let iconList = [];

for (let icon of icons) {
if (!icon.purpose.split().includes(purpose)) continue;
if (!icon.purpose.split(' ').includes(purpose)) continue;

for (let sizeSpec of icon.sizes.split()) {
for (let sizeSpec of icon.sizes.split(' ')) {
const size = sizeSpec === 'any' ? Number.MAX_SAFE_INTEGER : parseInt(sizeSpec);
iconList.push({ icon, size });
}
Expand All @@ -90,6 +90,10 @@ function buildIconList (icons, purpose = 'any') {
}

async function getIcon (icons, size) {
// Filter out SVG icons as they are not supported by `setWindowIcon`
// Support for SVG icons will be added in the future
icons = icons.filter(icon => icon.icon.type !== 'image/svg+xml' && !icon.icon.src.endsWith('.svg'))

if (icons.length === 0) return null;

let icon = icons.find(icon => icon.size >= size);
Expand Down

0 comments on commit facdfda

Please sign in to comment.