Skip to content

Commit

Permalink
Fixing try and app icons
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanbossenger committed Jan 26, 2025
1 parent a4cf474 commit a50e48b
Show file tree
Hide file tree
Showing 9 changed files with 192 additions and 394 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ ehthumbs.db
Thumbs.db

# Electron forge output
out/
out/

# Generated icons
assets/icons/
assets/tray-icon.png
Binary file modified assets/tray-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 35 additions & 3 deletions forge.config.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
module.exports = {
packagerConfig: {
asar: true,
name: 'WP Debug',
executableName: 'wp-debug',
icon: './assets/icons/icon',
appBundleId: 'com.wp-debug.app',
appCategoryType: 'public.app-category.developer-tools',
protocols: [
{
name: 'WP Debug',
schemes: ['wp-debug']
}
]
},
rebuildConfig: {},
makers: [
{
name: '@electron-forge/maker-squirrel',
config: {},
config: {
name: 'wp-debug',
iconUrl: './assets/icons/icon.ico',
setupIcon: './assets/icons/icon.ico'
},
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin'],
config: {
icon: './assets/icons/icon.icns'
}
},
{
name: '@electron-forge/maker-deb',
config: {},
config: {
options: {
icon: './assets/icons/icon.png',
name: 'wp-debug',
productName: 'WP Debug',
categories: ['Development']
}
},
},
{
name: '@electron-forge/maker-rpm',
config: {},
config: {
options: {
icon: './assets/icons/icon.png',
name: 'wp-debug',
productName: 'WP Debug',
categories: ['Development']
}
},
},
],
};
15 changes: 4 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const { app, BrowserWindow, ipcMain, dialog, Tray, nativeImage, Notification } =
const path = require('path');
const chokidar = require('chokidar');
const fs = require('fs');
const sharp = require('sharp');

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
Expand Down Expand Up @@ -133,15 +132,8 @@ if (!function_exists('wp_debug')) {
};

const createTray = async () => {
// Convert SVG to PNG in memory
const svgBuffer = fs.readFileSync(path.join(__dirname, 'assets', 'bug-solid.svg'));
const pngBuffer = await sharp(svgBuffer)
.resize(16, 16)
.png()
.toBuffer();

// Create native image from PNG buffer
const trayIcon = nativeImage.createFromBuffer(pngBuffer);
// Use the pre-generated PNG icon
const trayIcon = nativeImage.createFromPath(path.join(__dirname, 'assets', 'tray-icon.png'));

tray = new Tray(trayIcon);
tray.setToolTip('WP Debug');
Expand Down Expand Up @@ -170,7 +162,7 @@ const showNotification = (message) => {
body: firstLine,
silent: false,
timeoutType: 'default',
icon: path.join(__dirname, 'assets', 'bug-solid.svg') // Add the bug icon to notifications
icon: path.join(__dirname, 'assets', 'icons', 'mac', '128x128.png') // Use platform-specific icon
});

notification.show();
Expand All @@ -189,6 +181,7 @@ const createWindow = () => {
mainWindow = new BrowserWindow({
width: 1024,
height: 768,
title: 'WP Debug',
webPreferences: {
nodeIntegration: true,
contextIsolation: true,
Expand Down
42 changes: 40 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a50e48b

Please sign in to comment.