From 10f9559a526821e7f81281fd88b0a2cdc0961c6f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 27 Mar 2023 12:59:39 -0400 Subject: [PATCH] Add 64px toolbar icon for 4K displays Related issue: - https://github.com/uBlockOrigin/uBlock-issues/issues/2477 --- platform/chromium/manifest.json | 3 ++- platform/common/vapi-background.js | 18 +++++++++++++----- platform/firefox/manifest.json | 3 ++- platform/opera/manifest.json | 3 ++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/platform/chromium/manifest.json b/platform/chromium/manifest.json index 8e758abb0..c48776edc 100644 --- a/platform/chromium/manifest.json +++ b/platform/chromium/manifest.json @@ -6,7 +6,8 @@ "browser_action": { "default_icon": { "16": "img/icon_16.png", - "32": "img/icon_32.png" + "32": "img/icon_32.png", + "64": "img/icon_64.png" }, "default_title": "uBlock Origin", "default_popup": "popup-fenix.html" diff --git a/platform/common/vapi-background.js b/platform/common/vapi-background.js index 3de888847..d57628849 100644 --- a/platform/common/vapi-background.js +++ b/platform/common/vapi-background.js @@ -674,8 +674,16 @@ if ( webext.browserAction instanceof Object ) { browser.runtime.getManifest().browser_action.default_title + ' ({badge})'; const icons = [ - { path: { '16': 'img/icon_16-off.png', '32': 'img/icon_32-off.png' } }, - { path: { '16': 'img/icon_16.png', '32': 'img/icon_32.png' } }, + { path: { + '16': 'img/icon_16-off.png', + '32': 'img/icon_32-off.png', + '64': 'img/icon_64-off.png', + } }, + { path: { + '16': 'img/icon_16.png', + '32': 'img/icon_32.png', + '64': 'img/icon_64.png', + } }, ]; (( ) => { @@ -702,9 +710,8 @@ if ( webext.browserAction instanceof Object ) { const imgs = []; for ( let i = 0; i < icons.length; i++ ) { - const path = icons[i].path; - for ( const key in path ) { - if ( path.hasOwnProperty(key) === false ) { continue; } + for ( const key of Object.keys(icons[i].path) ) { + if ( parseInt(key, 10) >= 64 ) { continue; } imgs.push({ i: i, p: key, cached: false }); } } @@ -818,6 +825,7 @@ if ( webext.browserAction instanceof Object ) { path: { '16': `img/icon_16${flavor}.png`, '32': `img/icon_32${flavor}.png`, + '64': `img/icon_64${flavor}.png`, } }); browserAction.setBadgeText({ text }); diff --git a/platform/firefox/manifest.json b/platform/firefox/manifest.json index 44d953672..b7ea2e375 100644 --- a/platform/firefox/manifest.json +++ b/platform/firefox/manifest.json @@ -7,7 +7,8 @@ "browser_style": false, "default_icon": { "16": "img/icon_16.png", - "32": "img/icon_32.png" + "32": "img/icon_32.png", + "64": "img/icon_64.png" }, "default_title": "uBlock Origin", "default_popup": "popup-fenix.html" diff --git a/platform/opera/manifest.json b/platform/opera/manifest.json index d451cc9d2..d5b02fb3e 100644 --- a/platform/opera/manifest.json +++ b/platform/opera/manifest.json @@ -6,7 +6,8 @@ "browser_action": { "default_icon": { "16": "img/icon_16.png", - "32": "img/icon_32.png" + "32": "img/icon_32.png", + "64": "img/icon_64.png" }, "default_popup": "popup-fenix.html", "default_title": "uBlock Origin"