From 3322e1ab212c006a3e0f697143a52d975b8fbb77 Mon Sep 17 00:00:00 2001 From: Sebastian Reinado Date: Thu, 12 Mar 2026 04:39:27 -0300 Subject: [PATCH 1/2] Fix typo: 'your' -> 'you' in contributing.md --- contributing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contributing.md b/contributing.md index 43d68d85d..8fad81e33 100644 --- a/contributing.md +++ b/contributing.md @@ -8,7 +8,7 @@ There is an issue template for you to follow. Please provide as much information Thank you in advance for your help. ### When you open a pull request -There is a pull request template for your to follow. Please fill in the template before submitting your code. Your pull request will be reviewed faster if we know exactly what it does. +There is a pull request template for you to follow. Please fill in the template before submitting your code. Your pull request will be reviewed faster if we know exactly what it does. Make sure that you have: - Checked [`code_style.md`](docs/code_style.md) for information on code style From 21928649be93c640bb5e5d9fe84319b10989729a Mon Sep 17 00:00:00 2001 From: Sebastian Reinado Date: Thu, 12 Mar 2026 11:22:57 -0300 Subject: [PATCH 2/2] fix: Add tray icon support for Linux (fixes #377) - Create lib/main-tray.js to handle tray icon functionality - Modify lib/main-app.js to initialize tray on Linux - Use existing tray-icon.png assets from resources/ - Add context menu: Show/Hide Boostnote, Quit - Handle click and double-click events This implements system tray icon support for Ubuntu/Linux systems, which was missing in the original codebase. Issue: https://github.com/BoostIO/BoostNote-Legacy/issues/377 Bounty: 5 on IssueHunt --- lib/main-app.js | 6 +++ lib/main-tray.js | 102 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 lib/main-tray.js diff --git a/lib/main-app.js b/lib/main-app.js index cc3439bc1..9c8cc624b 100644 --- a/lib/main-app.js +++ b/lib/main-app.js @@ -118,6 +118,12 @@ app.on('ready', function() { mainWindow.setMenu(menu) } + // Create tray icon for Linux (fixes issue #377) + if (process.platform === 'linux') { + const mainTray = require('./main-tray') + mainTray.createTray(mainWindow) + } + // Check update every day setInterval(function() { if (isPackaged) checkUpdate() diff --git a/lib/main-tray.js b/lib/main-tray.js new file mode 100644 index 000000000..8a5cabaab --- /dev/null +++ b/lib/main-tray.js @@ -0,0 +1,102 @@ +const { Tray, Menu, app, nativeImage } = require('electron') +const path = require('path') + +let tray = null + +/** + * Create tray icon for Linux + * This functionality was missing in the original codebase + * Issue: https://github.com/BoostIO/BoostNote-Legacy/issues/377 + */ +function createTray(mainWindow) { + // Only create tray on Linux + if (process.platform !== 'linux') { + return null + } + + // Get the appropriate tray icon + const iconPath = path.join(__dirname, '../resources/tray-icon.png') + + // Create native image for tray icon + let icon + try { + icon = nativeImage.createFromPath(iconPath) + + // Try @2x version for HiDPI displays + if (icon.isEmpty()) { + const iconPath2x = path.join(__dirname, '../resources/tray-icon@2x.png') + icon = nativeImage.createFromPath(iconPath2x) + } + } catch (e) { + console.error('Failed to load tray icon:', e) + return null + } + + if (icon.isEmpty()) { + console.warn('Tray icon is empty, skipping tray creation') + return null + } + + // Create tray + tray = new Tray(icon) + + // Set tooltip + tray.setToolTip('Boostnote') + + // Context menu + const contextMenu = Menu.buildFromTemplate([ + { + label: 'Show Boostnote', + click: () => { + if (mainWindow) { + mainWindow.show() + mainWindow.focus() + } + } + }, + { + label: 'Hide Boostnote', + click: () => { + if (mainWindow) { + mainWindow.hide() + } + } + }, + { type: 'separator' }, + { + label: 'Quit', + click: () => { + app.quit() + } + } + ]) + + tray.setContextMenu(contextMenu) + + // Handle click - show/hide window + tray.on('click', () => { + if (mainWindow) { + if (mainWindow.isVisible()) { + mainWindow.hide() + } else { + mainWindow.show() + mainWindow.focus() + } + } + }) + + // Handle double-click - show window + tray.on('double-click', () => { + if (mainWindow) { + mainWindow.show() + mainWindow.focus() + } + }) + + return tray +} + +module.exports = { + createTray, + getTray: () => tray +} \ No newline at end of file