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 000000000..31504fcb7 Binary files /dev/null and b/images/app-icons/tray/bookmarks-16.png differ diff --git a/images/app-icons/tray/close-16.png b/images/app-icons/tray/close-16.png new file mode 100644 index 000000000..a2757dce7 Binary files /dev/null and b/images/app-icons/tray/close-16.png differ 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 000000000..6dbce54c2 Binary files /dev/null and b/images/app-icons/tray/new-note-16.png differ diff --git a/images/app-icons/tray/recents-16.png b/images/app-icons/tray/recents-16.png new file mode 100644 index 000000000..8f64674c7 Binary files /dev/null and b/images/app-icons/tray/recents-16.png differ diff --git a/images/app-icons/tray/today-16.png b/images/app-icons/tray/today-16.png new file mode 100644 index 000000000..c37f139c8 Binary files /dev/null and b/images/app-icons/tray/today-16.png differ diff --git a/src/services/tray.ts b/src/services/tray.ts index 600898bdf..d6da1c290 100644 --- a/src/services/tray.ts +++ b/src/services/tray.ts @@ -27,12 +27,17 @@ function getIconSize() { } } -function getIconPath() { +function getTrayIconPath() { const iconSize = getIconSize(); return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "png", `${iconSize}x${iconSize}.png`); } +function getIconPath(name: string) { + const size = 16; + return path.join(path.dirname(fileURLToPath(import.meta.url)), "../..", "images", "app-icons", "tray", `${name}-${size}.png`); +} + function registerVisibilityListener() { const mainWindow = windowService.getMainWindow(); if (!mainWindow) { @@ -127,27 +132,32 @@ function updateTrayMenu() { { label: "New note", type: "normal", + icon: getIconPath("new-note"), click: () => 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);