From 736f329857561405447369b6bc2e3bd892b24cb5 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 1 Feb 2025 10:18:41 +0200 Subject: [PATCH] feat(tray): use icons for tray items --- bin/tray-icons/bookmarks.svg | 1 + bin/tray-icons/build-icons.sh | 14 ++++++++++++++ bin/tray-icons/close.svg | 1 + bin/tray-icons/new-note.svg | 1 + bin/tray-icons/recents.svg | 1 + bin/tray-icons/today.svg | 1 + images/app-icons/tray/bookmarks-16.png | Bin 0 -> 314 bytes images/app-icons/tray/close-16.png | Bin 0 -> 254 bytes images/app-icons/tray/new-note-16.png | Bin 0 -> 202 bytes images/app-icons/tray/recents-16.png | Bin 0 -> 449 bytes images/app-icons/tray/today-16.png | Bin 0 -> 379 bytes src/services/tray.ts | 14 ++++++++++++-- 12 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 bin/tray-icons/bookmarks.svg create mode 100644 bin/tray-icons/build-icons.sh create mode 100644 bin/tray-icons/close.svg create mode 100644 bin/tray-icons/new-note.svg create mode 100644 bin/tray-icons/recents.svg create mode 100644 bin/tray-icons/today.svg create mode 100644 images/app-icons/tray/bookmarks-16.png create mode 100644 images/app-icons/tray/close-16.png create mode 100644 images/app-icons/tray/new-note-16.png create mode 100644 images/app-icons/tray/recents-16.png create mode 100644 images/app-icons/tray/today-16.png diff --git a/bin/tray-icons/bookmarks.svg b/bin/tray-icons/bookmarks.svg new file mode 100644 index 000000000..ca70cb9ac --- /dev/null +++ b/bin/tray-icons/bookmarks.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bin/tray-icons/build-icons.sh b/bin/tray-icons/build-icons.sh new file mode 100644 index 000000000..7fc9954b2 --- /dev/null +++ b/bin/tray-icons/build-icons.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +if ! command -v inkscape &> /dev/null; then + echo "This tool requires Inkscape to be render sharper SVGs than ImageMagick." + exit 1 +fi + +script_dir=$(realpath $(dirname $0)) +output_dir="$script_dir/../../images/app-icons/tray" + +for file in *.svg; do + name=$(basename $file .svg) + inkscape -w 16 -h 16 "$file" -o "$output_dir/$name-16.png" +done \ No newline at end of file diff --git a/bin/tray-icons/close.svg b/bin/tray-icons/close.svg new file mode 100644 index 000000000..daf078d2d --- /dev/null +++ b/bin/tray-icons/close.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bin/tray-icons/new-note.svg b/bin/tray-icons/new-note.svg new file mode 100644 index 000000000..b3c855db9 --- /dev/null +++ b/bin/tray-icons/new-note.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bin/tray-icons/recents.svg b/bin/tray-icons/recents.svg new file mode 100644 index 000000000..4982db75e --- /dev/null +++ b/bin/tray-icons/recents.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/bin/tray-icons/today.svg b/bin/tray-icons/today.svg new file mode 100644 index 000000000..2a475e158 --- /dev/null +++ b/bin/tray-icons/today.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/images/app-icons/tray/bookmarks-16.png b/images/app-icons/tray/bookmarks-16.png new file mode 100644 index 0000000000000000000000000000000000000000..31504fcb7dfcdf406152e7fdfc4b61d1be39c1bc GIT binary patch literal 314 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#X#yh2s3WX6WN&PEET=(wkgV~9oX+slSt%!vX=Ki(IX zzG!sJtEjVrHDBNe_Y;OV7Xf}j8%I9H8%wu(tXz8VP*Tpc4eNGuPrBBa`S1Rj+3yef ztU9Gwc!zzmkKysmX1fnDq4{@jEuQx*+9u)FA@K^IqR-h;p>KtsM{JFJUfb$9yR_cm zc-4_lQsK#B=Qc%(uP{r`X*-U|?kkx8gmwLoN}IX9 z(Fx6}mmX!_VCydPzjb{^O4H<3xA<=CI+7l`_x;U<&;Rf?&qxhPlb-Sq=p_bES3j3^ HP6N&PEETsN2)UF~p+x>SRN{!wLc{>B{y8 zSy^4{-lYfZ=>9ZAq|#|gX|usL9^Sknp|eGscQsqzOjD6_{_>V>Qkv(&sXCe-v#LdX z4k&5H9T1EtIw!Y{pS|M%mrZrlPHXP;1?=X$T9d^;B!xoGS vuZ6yMlACn$+w)a-ZBp!S-(U3izfrFB!5i&DH$#sCoyFkk>gTe~DWM4f5FT4! literal 0 HcmV?d00001 diff --git a/images/app-icons/tray/new-note-16.png b/images/app-icons/tray/new-note-16.png new file mode 100644 index 0000000000000000000000000000000000000000..6dbce54c22a7647debb4c5a95a846d94fabc1b9b GIT binary patch literal 202 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#X#yh2s3WX6WN&PEETDBRPj-RYkZ<8hkoh%}li~4Ek%&)afp>vcFnGH9xvXNL(J`7$AJIKoGG zqWz8kjPWt9%}k-$oA&0XRkhq#QdMWFY7^Vteob~^7hjXSt*RYtR@HZWZ1`m?<6)9_ rGlh@Z#;Q7tiztkfd>iB)cb)$Nja|+=H-)~%00000NkvXXu0mjfX0pQO literal 0 HcmV?d00001 diff --git a/images/app-icons/tray/today-16.png b/images/app-icons/tray/today-16.png new file mode 100644 index 0000000000000000000000000000000000000000..c37f139c82dae5844a314238b590b2eadaaf3698 GIT binary patch literal 379 zcmV->0fhdEP)cIjBgXZjEIMbI|T!y%CiR(mr2fy*}f! triggerKeyboardAction("createNoteIntoInbox") }, { label: "Open today's journal note", type: "normal", + icon: getIconPath("today"), click: () => openInSameTab(date_notes.getTodayNote()) }, { label: "Bookmarks", type: "submenu", + icon: getIconPath("bookmarks"), submenu: buildBookmarksMenu() }, { label: "Recent notes", type: "submenu", + icon: getIconPath("recents"), submenu: buildRecentNotesMenu() }, { type: "separator" }, { label: "Quit Trilium", type: "normal", + icon: getIconPath("close"), click: () => { mainWindow.close(); } @@ -176,7 +186,7 @@ function createTray() { return; } - tray = new Tray(getIconPath()); + tray = new Tray(getTrayIconPath()); tray.setToolTip("TriliumNext Notes"); // Restore focus tray.on("click", changeVisibility);