From 495fce7594a88209588cd937210a15fb35e845b2 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 1 Feb 2025 12:57:51 +0200 Subject: [PATCH] feat(tray): use template for menu icons --- bin/tray-icons/build-icons.sh | 4 ++-- ...-inverted.png => bookmarksTemplate-inverted.png} | Bin ...25x.png => bookmarksTemplate-inverted@1.25x.png} | Bin ...1.5x.png => bookmarksTemplate-inverted@1.5x.png} | Bin ...ted@2x.png => bookmarksTemplate-inverted@2x.png} | Bin .../tray/{bookmarks.png => bookmarksTemplate.png} | Bin ...kmarks@1.25x.png => bookmarksTemplate@1.25x.png} | Bin ...ookmarks@1.5x.png => bookmarksTemplate@1.5x.png} | Bin .../{bookmarks@2x.png => bookmarksTemplate@2x.png} | Bin ...lose-inverted.png => closeTemplate-inverted.png} | Bin ...d@1.25x.png => closeTemplate-inverted@1.25x.png} | Bin ...ted@1.5x.png => closeTemplate-inverted@1.5x.png} | Bin ...nverted@2x.png => closeTemplate-inverted@2x.png} | Bin .../app-icons/tray/{close.png => closeTemplate.png} | Bin .../{close@1.25x.png => closeTemplate@1.25x.png} | Bin .../tray/{close@1.5x.png => closeTemplate@1.5x.png} | Bin .../tray/{close@2x.png => closeTemplate@2x.png} | Bin ...e-inverted.png => new-noteTemplate-inverted.png} | Bin ....25x.png => new-noteTemplate-inverted@1.25x.png} | Bin ...@1.5x.png => new-noteTemplate-inverted@1.5x.png} | Bin ...rted@2x.png => new-noteTemplate-inverted@2x.png} | Bin .../tray/{new-note.png => new-noteTemplate.png} | Bin ...ew-note@1.25x.png => new-noteTemplate@1.25x.png} | Bin ...{new-note@1.5x.png => new-noteTemplate@1.5x.png} | Bin .../{new-note@2x.png => new-noteTemplate@2x.png} | Bin ...ts-inverted.png => recentsTemplate-inverted.png} | Bin ...1.25x.png => recentsTemplate-inverted@1.25x.png} | Bin ...d@1.5x.png => recentsTemplate-inverted@1.5x.png} | Bin ...erted@2x.png => recentsTemplate-inverted@2x.png} | Bin .../tray/{recents.png => recentsTemplate.png} | Bin ...{recents@1.25x.png => recentsTemplate@1.25x.png} | Bin .../{recents@1.5x.png => recentsTemplate@1.5x.png} | Bin .../tray/{recents@2x.png => recentsTemplate@2x.png} | Bin ...oday-inverted.png => todayTemplate-inverted.png} | Bin ...d@1.25x.png => todayTemplate-inverted@1.25x.png} | Bin ...ted@1.5x.png => todayTemplate-inverted@1.5x.png} | Bin ...nverted@2x.png => todayTemplate-inverted@2x.png} | Bin .../app-icons/tray/{today.png => todayTemplate.png} | Bin .../{today@1.25x.png => todayTemplate@1.25x.png} | Bin .../tray/{today@1.5x.png => todayTemplate@1.5x.png} | Bin .../tray/{today@2x.png => todayTemplate@2x.png} | Bin src/services/tray.ts | 9 ++++++--- 42 files changed, 8 insertions(+), 5 deletions(-) rename images/app-icons/tray/{bookmarks-inverted.png => bookmarksTemplate-inverted.png} (100%) rename images/app-icons/tray/{bookmarks-inverted@1.25x.png => bookmarksTemplate-inverted@1.25x.png} (100%) rename images/app-icons/tray/{bookmarks-inverted@1.5x.png => bookmarksTemplate-inverted@1.5x.png} (100%) rename images/app-icons/tray/{bookmarks-inverted@2x.png => bookmarksTemplate-inverted@2x.png} (100%) rename images/app-icons/tray/{bookmarks.png => bookmarksTemplate.png} (100%) rename images/app-icons/tray/{bookmarks@1.25x.png => bookmarksTemplate@1.25x.png} (100%) rename images/app-icons/tray/{bookmarks@1.5x.png => bookmarksTemplate@1.5x.png} (100%) rename images/app-icons/tray/{bookmarks@2x.png => bookmarksTemplate@2x.png} (100%) rename images/app-icons/tray/{close-inverted.png => closeTemplate-inverted.png} (100%) rename images/app-icons/tray/{close-inverted@1.25x.png => closeTemplate-inverted@1.25x.png} (100%) rename images/app-icons/tray/{close-inverted@1.5x.png => closeTemplate-inverted@1.5x.png} (100%) rename images/app-icons/tray/{close-inverted@2x.png => closeTemplate-inverted@2x.png} (100%) rename images/app-icons/tray/{close.png => closeTemplate.png} (100%) rename images/app-icons/tray/{close@1.25x.png => closeTemplate@1.25x.png} (100%) rename images/app-icons/tray/{close@1.5x.png => closeTemplate@1.5x.png} (100%) rename images/app-icons/tray/{close@2x.png => closeTemplate@2x.png} (100%) rename images/app-icons/tray/{new-note-inverted.png => new-noteTemplate-inverted.png} (100%) rename images/app-icons/tray/{new-note-inverted@1.25x.png => new-noteTemplate-inverted@1.25x.png} (100%) rename images/app-icons/tray/{new-note-inverted@1.5x.png => new-noteTemplate-inverted@1.5x.png} (100%) rename images/app-icons/tray/{new-note-inverted@2x.png => new-noteTemplate-inverted@2x.png} (100%) rename images/app-icons/tray/{new-note.png => new-noteTemplate.png} (100%) rename images/app-icons/tray/{new-note@1.25x.png => new-noteTemplate@1.25x.png} (100%) rename images/app-icons/tray/{new-note@1.5x.png => new-noteTemplate@1.5x.png} (100%) rename images/app-icons/tray/{new-note@2x.png => new-noteTemplate@2x.png} (100%) rename images/app-icons/tray/{recents-inverted.png => recentsTemplate-inverted.png} (100%) rename images/app-icons/tray/{recents-inverted@1.25x.png => recentsTemplate-inverted@1.25x.png} (100%) rename images/app-icons/tray/{recents-inverted@1.5x.png => recentsTemplate-inverted@1.5x.png} (100%) rename images/app-icons/tray/{recents-inverted@2x.png => recentsTemplate-inverted@2x.png} (100%) rename images/app-icons/tray/{recents.png => recentsTemplate.png} (100%) rename images/app-icons/tray/{recents@1.25x.png => recentsTemplate@1.25x.png} (100%) rename images/app-icons/tray/{recents@1.5x.png => recentsTemplate@1.5x.png} (100%) rename images/app-icons/tray/{recents@2x.png => recentsTemplate@2x.png} (100%) rename images/app-icons/tray/{today-inverted.png => todayTemplate-inverted.png} (100%) rename images/app-icons/tray/{today-inverted@1.25x.png => todayTemplate-inverted@1.25x.png} (100%) rename images/app-icons/tray/{today-inverted@1.5x.png => todayTemplate-inverted@1.5x.png} (100%) rename images/app-icons/tray/{today-inverted@2x.png => todayTemplate-inverted@2x.png} (100%) rename images/app-icons/tray/{today.png => todayTemplate.png} (100%) rename images/app-icons/tray/{today@1.25x.png => todayTemplate@1.25x.png} (100%) rename images/app-icons/tray/{today@1.5x.png => todayTemplate@1.5x.png} (100%) rename images/app-icons/tray/{today@2x.png => todayTemplate@2x.png} (100%) diff --git a/bin/tray-icons/build-icons.sh b/bin/tray-icons/build-icons.sh index 893796746..9d77f6a89 100644 --- a/bin/tray-icons/build-icons.sh +++ b/bin/tray-icons/build-icons.sh @@ -29,8 +29,8 @@ generateDpiScaledIcons "$images_dir/icon-color.svg" generateDpiScaledIcons "$images_dir/icon-purple.svg" for file in *.svg; do - name=$(basename $file .svg) - generateDpiScaledIcons "$file" + name="$(basename $file .svg)Template" + generateDpiScaledIcons "$file" "Template" magick "$output_dir/$name.png" -channel RGB -negate "$output_dir/$name-inverted.png" magick "$output_dir/$name@1.25x.png" -channel RGB -negate "$output_dir/$name-inverted@1.25x.png" magick "$output_dir/$name@1.5x.png" -channel RGB -negate "$output_dir/$name-inverted@1.5x.png" diff --git a/images/app-icons/tray/bookmarks-inverted.png b/images/app-icons/tray/bookmarksTemplate-inverted.png similarity index 100% rename from images/app-icons/tray/bookmarks-inverted.png rename to images/app-icons/tray/bookmarksTemplate-inverted.png diff --git a/images/app-icons/tray/bookmarks-inverted@1.25x.png b/images/app-icons/tray/bookmarksTemplate-inverted@1.25x.png similarity index 100% rename from images/app-icons/tray/bookmarks-inverted@1.25x.png rename to images/app-icons/tray/bookmarksTemplate-inverted@1.25x.png diff --git a/images/app-icons/tray/bookmarks-inverted@1.5x.png b/images/app-icons/tray/bookmarksTemplate-inverted@1.5x.png similarity index 100% rename from images/app-icons/tray/bookmarks-inverted@1.5x.png rename to images/app-icons/tray/bookmarksTemplate-inverted@1.5x.png diff --git a/images/app-icons/tray/bookmarks-inverted@2x.png b/images/app-icons/tray/bookmarksTemplate-inverted@2x.png similarity index 100% rename from images/app-icons/tray/bookmarks-inverted@2x.png rename to images/app-icons/tray/bookmarksTemplate-inverted@2x.png diff --git a/images/app-icons/tray/bookmarks.png b/images/app-icons/tray/bookmarksTemplate.png similarity index 100% rename from images/app-icons/tray/bookmarks.png rename to images/app-icons/tray/bookmarksTemplate.png diff --git a/images/app-icons/tray/bookmarks@1.25x.png b/images/app-icons/tray/bookmarksTemplate@1.25x.png similarity index 100% rename from images/app-icons/tray/bookmarks@1.25x.png rename to images/app-icons/tray/bookmarksTemplate@1.25x.png diff --git a/images/app-icons/tray/bookmarks@1.5x.png b/images/app-icons/tray/bookmarksTemplate@1.5x.png similarity index 100% rename from images/app-icons/tray/bookmarks@1.5x.png rename to images/app-icons/tray/bookmarksTemplate@1.5x.png diff --git a/images/app-icons/tray/bookmarks@2x.png b/images/app-icons/tray/bookmarksTemplate@2x.png similarity index 100% rename from images/app-icons/tray/bookmarks@2x.png rename to images/app-icons/tray/bookmarksTemplate@2x.png diff --git a/images/app-icons/tray/close-inverted.png b/images/app-icons/tray/closeTemplate-inverted.png similarity index 100% rename from images/app-icons/tray/close-inverted.png rename to images/app-icons/tray/closeTemplate-inverted.png diff --git a/images/app-icons/tray/close-inverted@1.25x.png b/images/app-icons/tray/closeTemplate-inverted@1.25x.png similarity index 100% rename from images/app-icons/tray/close-inverted@1.25x.png rename to images/app-icons/tray/closeTemplate-inverted@1.25x.png diff --git a/images/app-icons/tray/close-inverted@1.5x.png b/images/app-icons/tray/closeTemplate-inverted@1.5x.png similarity index 100% rename from images/app-icons/tray/close-inverted@1.5x.png rename to images/app-icons/tray/closeTemplate-inverted@1.5x.png diff --git a/images/app-icons/tray/close-inverted@2x.png b/images/app-icons/tray/closeTemplate-inverted@2x.png similarity index 100% rename from images/app-icons/tray/close-inverted@2x.png rename to images/app-icons/tray/closeTemplate-inverted@2x.png diff --git a/images/app-icons/tray/close.png b/images/app-icons/tray/closeTemplate.png similarity index 100% rename from images/app-icons/tray/close.png rename to images/app-icons/tray/closeTemplate.png diff --git a/images/app-icons/tray/close@1.25x.png b/images/app-icons/tray/closeTemplate@1.25x.png similarity index 100% rename from images/app-icons/tray/close@1.25x.png rename to images/app-icons/tray/closeTemplate@1.25x.png diff --git a/images/app-icons/tray/close@1.5x.png b/images/app-icons/tray/closeTemplate@1.5x.png similarity index 100% rename from images/app-icons/tray/close@1.5x.png rename to images/app-icons/tray/closeTemplate@1.5x.png diff --git a/images/app-icons/tray/close@2x.png b/images/app-icons/tray/closeTemplate@2x.png similarity index 100% rename from images/app-icons/tray/close@2x.png rename to images/app-icons/tray/closeTemplate@2x.png diff --git a/images/app-icons/tray/new-note-inverted.png b/images/app-icons/tray/new-noteTemplate-inverted.png similarity index 100% rename from images/app-icons/tray/new-note-inverted.png rename to images/app-icons/tray/new-noteTemplate-inverted.png diff --git a/images/app-icons/tray/new-note-inverted@1.25x.png b/images/app-icons/tray/new-noteTemplate-inverted@1.25x.png similarity index 100% rename from images/app-icons/tray/new-note-inverted@1.25x.png rename to images/app-icons/tray/new-noteTemplate-inverted@1.25x.png diff --git a/images/app-icons/tray/new-note-inverted@1.5x.png b/images/app-icons/tray/new-noteTemplate-inverted@1.5x.png similarity index 100% rename from images/app-icons/tray/new-note-inverted@1.5x.png rename to images/app-icons/tray/new-noteTemplate-inverted@1.5x.png diff --git a/images/app-icons/tray/new-note-inverted@2x.png b/images/app-icons/tray/new-noteTemplate-inverted@2x.png similarity index 100% rename from images/app-icons/tray/new-note-inverted@2x.png rename to images/app-icons/tray/new-noteTemplate-inverted@2x.png diff --git a/images/app-icons/tray/new-note.png b/images/app-icons/tray/new-noteTemplate.png similarity index 100% rename from images/app-icons/tray/new-note.png rename to images/app-icons/tray/new-noteTemplate.png diff --git a/images/app-icons/tray/new-note@1.25x.png b/images/app-icons/tray/new-noteTemplate@1.25x.png similarity index 100% rename from images/app-icons/tray/new-note@1.25x.png rename to images/app-icons/tray/new-noteTemplate@1.25x.png diff --git a/images/app-icons/tray/new-note@1.5x.png b/images/app-icons/tray/new-noteTemplate@1.5x.png similarity index 100% rename from images/app-icons/tray/new-note@1.5x.png rename to images/app-icons/tray/new-noteTemplate@1.5x.png diff --git a/images/app-icons/tray/new-note@2x.png b/images/app-icons/tray/new-noteTemplate@2x.png similarity index 100% rename from images/app-icons/tray/new-note@2x.png rename to images/app-icons/tray/new-noteTemplate@2x.png diff --git a/images/app-icons/tray/recents-inverted.png b/images/app-icons/tray/recentsTemplate-inverted.png similarity index 100% rename from images/app-icons/tray/recents-inverted.png rename to images/app-icons/tray/recentsTemplate-inverted.png diff --git a/images/app-icons/tray/recents-inverted@1.25x.png b/images/app-icons/tray/recentsTemplate-inverted@1.25x.png similarity index 100% rename from images/app-icons/tray/recents-inverted@1.25x.png rename to images/app-icons/tray/recentsTemplate-inverted@1.25x.png diff --git a/images/app-icons/tray/recents-inverted@1.5x.png b/images/app-icons/tray/recentsTemplate-inverted@1.5x.png similarity index 100% rename from images/app-icons/tray/recents-inverted@1.5x.png rename to images/app-icons/tray/recentsTemplate-inverted@1.5x.png diff --git a/images/app-icons/tray/recents-inverted@2x.png b/images/app-icons/tray/recentsTemplate-inverted@2x.png similarity index 100% rename from images/app-icons/tray/recents-inverted@2x.png rename to images/app-icons/tray/recentsTemplate-inverted@2x.png diff --git a/images/app-icons/tray/recents.png b/images/app-icons/tray/recentsTemplate.png similarity index 100% rename from images/app-icons/tray/recents.png rename to images/app-icons/tray/recentsTemplate.png diff --git a/images/app-icons/tray/recents@1.25x.png b/images/app-icons/tray/recentsTemplate@1.25x.png similarity index 100% rename from images/app-icons/tray/recents@1.25x.png rename to images/app-icons/tray/recentsTemplate@1.25x.png diff --git a/images/app-icons/tray/recents@1.5x.png b/images/app-icons/tray/recentsTemplate@1.5x.png similarity index 100% rename from images/app-icons/tray/recents@1.5x.png rename to images/app-icons/tray/recentsTemplate@1.5x.png diff --git a/images/app-icons/tray/recents@2x.png b/images/app-icons/tray/recentsTemplate@2x.png similarity index 100% rename from images/app-icons/tray/recents@2x.png rename to images/app-icons/tray/recentsTemplate@2x.png diff --git a/images/app-icons/tray/today-inverted.png b/images/app-icons/tray/todayTemplate-inverted.png similarity index 100% rename from images/app-icons/tray/today-inverted.png rename to images/app-icons/tray/todayTemplate-inverted.png diff --git a/images/app-icons/tray/today-inverted@1.25x.png b/images/app-icons/tray/todayTemplate-inverted@1.25x.png similarity index 100% rename from images/app-icons/tray/today-inverted@1.25x.png rename to images/app-icons/tray/todayTemplate-inverted@1.25x.png diff --git a/images/app-icons/tray/today-inverted@1.5x.png b/images/app-icons/tray/todayTemplate-inverted@1.5x.png similarity index 100% rename from images/app-icons/tray/today-inverted@1.5x.png rename to images/app-icons/tray/todayTemplate-inverted@1.5x.png diff --git a/images/app-icons/tray/today-inverted@2x.png b/images/app-icons/tray/todayTemplate-inverted@2x.png similarity index 100% rename from images/app-icons/tray/today-inverted@2x.png rename to images/app-icons/tray/todayTemplate-inverted@2x.png diff --git a/images/app-icons/tray/today.png b/images/app-icons/tray/todayTemplate.png similarity index 100% rename from images/app-icons/tray/today.png rename to images/app-icons/tray/todayTemplate.png diff --git a/images/app-icons/tray/today@1.25x.png b/images/app-icons/tray/todayTemplate@1.25x.png similarity index 100% rename from images/app-icons/tray/today@1.25x.png rename to images/app-icons/tray/todayTemplate@1.25x.png diff --git a/images/app-icons/tray/today@1.5x.png b/images/app-icons/tray/todayTemplate@1.5x.png similarity index 100% rename from images/app-icons/tray/today@1.5x.png rename to images/app-icons/tray/todayTemplate@1.5x.png diff --git a/images/app-icons/tray/today@2x.png b/images/app-icons/tray/todayTemplate@2x.png similarity index 100% rename from images/app-icons/tray/today@2x.png rename to images/app-icons/tray/todayTemplate@2x.png diff --git a/src/services/tray.ts b/src/services/tray.ts index 9e89214a2..e896e13e5 100644 --- a/src/services/tray.ts +++ b/src/services/tray.ts @@ -33,8 +33,8 @@ function getTrayIconPath() { } function getIconPath(name: string) { - const suffix = (nativeTheme.shouldUseDarkColors ? "-inverted" : ""); - return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "tray", `${name}${suffix}.png`); + const suffix = (!isMac && nativeTheme.shouldUseDarkColors ? "-inverted" : ""); + return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "tray", `${name}Template${suffix}.png`); } function registerVisibilityListener() { @@ -55,7 +55,10 @@ function registerVisibilityListener() { mainWindow.on("minimize", updateTrayMenu); mainWindow.on("maximize", updateTrayMenu); - nativeTheme.on("updated", updateTrayMenu); + if (!isMac) { + // macOS uses template icons which work great on dark & light themes. + nativeTheme.on("updated", updateTrayMenu); + } ipcMain.on("reload-tray", updateTrayMenu); i18next.on("languageChanged", updateTrayMenu); }