diff --git a/.gitignore b/.gitignore index f32beaa2..6695dc82 100644 --- a/.gitignore +++ b/.gitignore @@ -98,4 +98,7 @@ dist/ mas/ -build/ \ No newline at end of file +build/ + +entitlements.mas.inherit.plist +entitlements.mas.plist \ No newline at end of file diff --git a/assets/dmg/background.tiff b/assets/dmg/background.tiff deleted file mode 100644 index dfd80616..00000000 Binary files a/assets/dmg/background.tiff and /dev/null differ diff --git a/assets/icons/tray/tray.ico b/assets/icons/tray/tray.ico deleted file mode 100644 index 94303091..00000000 Binary files a/assets/icons/tray/tray.ico and /dev/null differ diff --git a/electron-builder.yml b/electron-builder.yml index ad93f68c..3dd08105 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -17,7 +17,7 @@ mac: role: Editor isPackage: false rank: Owner - icon: ./assets/icons/icon.icns + icon: ./resources/icon.icns type: distribution hardenedRuntime: true entitlements: assets/entitlements.mac.plist @@ -27,7 +27,6 @@ mac: artifactName: ${productName}-${version}-mac-${arch}.${ext} darkModeSupport: true dmg: - background: assets/dmg/background.tiff contents: - x: 130 'y': 220 @@ -49,7 +48,7 @@ win: - portable - nsis - appx - icon: assets/icons/sleek.ico + icon: resources/icon.ico artifactName: ${productName}-${version}-win-${arch}.${ext} nsis: artifactName: ${productName}-${version}-win-${arch}-Setup.${ext} @@ -60,7 +59,7 @@ appx: publisherDisplayName: ransome1 applicationId: RobinAhle.sleektodomanager linux: - icon: assets/icons + icon: resources/icon category: ProjectManagement target: - deb diff --git a/assets/icons/icon.icns b/resources/icon.icns similarity index 100% rename from assets/icons/icon.icns rename to resources/icon.icns diff --git a/assets/icons/sleek.ico b/resources/icon.ico similarity index 100% rename from assets/icons/sleek.ico rename to resources/icon.ico diff --git a/resources/icon.png b/resources/icon.png new file mode 100644 index 00000000..55ab1e97 Binary files /dev/null and b/resources/icon.png differ diff --git a/assets/icons/tray/tray.png b/resources/tray/tray.png similarity index 100% rename from assets/icons/tray/tray.png rename to resources/tray/tray.png diff --git a/assets/icons/tray/tray@1.25x.png b/resources/tray/tray@1.25x.png similarity index 100% rename from assets/icons/tray/tray@1.25x.png rename to resources/tray/tray@1.25x.png diff --git a/assets/icons/tray/tray@1.5x.png b/resources/tray/tray@1.5x.png similarity index 100% rename from assets/icons/tray/tray@1.5x.png rename to resources/tray/tray@1.5x.png diff --git a/assets/icons/tray/tray@1.75x.png b/resources/tray/tray@1.75x.png similarity index 100% rename from assets/icons/tray/tray@1.75x.png rename to resources/tray/tray@1.75x.png diff --git a/assets/icons/tray/tray@2x.png b/resources/tray/tray@2x.png similarity index 100% rename from assets/icons/tray/tray@2x.png rename to resources/tray/tray@2x.png diff --git a/assets/icons/tray/tray@3x.png b/resources/tray/tray@3x.png similarity index 100% rename from assets/icons/tray/tray@3x.png rename to resources/tray/tray@3x.png diff --git a/assets/icons/tray/tray@4x.png b/resources/tray/tray@4x.png similarity index 100% rename from assets/icons/tray/tray@4x.png rename to resources/tray/tray@4x.png diff --git a/src/main/index.ts b/src/main/index.ts index 2af8c14e..97cc9e53 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1,4 +1,4 @@ -import { app, BrowserWindow, nativeTheme } from 'electron'; +import { app, BrowserWindow, nativeTheme, nativeImage } from 'electron'; import { fileURLToPath } from 'url'; import path from 'path'; import fs from 'fs'; @@ -6,8 +6,10 @@ import { config } from './config.js'; import { createMenu } from './modules/Menu.js'; import { createFileWatcher, watcher } from './modules/File/Watcher.js'; import { createTray } from './modules/Tray.js'; +import macIcon from '../../resources/icon.icns?asset' +import windowsIcon from '../../resources/icon.ico?asset' +import linuxIcon from '../../resources/icon.png?asset' import './modules/IpcMain.js'; -import { electronApp, optimizer, is } from '@electron-toolkit/utils' const environment: string | undefined = process.env.NODE_ENV; let mainWindow: BrowserWindow | null = null; let eventListeners: Record = {}; @@ -105,10 +107,10 @@ const createMainWindow = () => { height: 1000, backgroundColor: (shouldUseDarkColors) ? '#212224' : '#fff', icon: process.platform === 'win32' - ? './assets/icons/sleek.ico' + ? nativeImage.createFromPath(windowsIcon) : process.platform === 'darwin' - ? './assets/icons/sleek.icns' - : './assets/icons/512x512.png', + ? nativeImage.createFromPath(macIcon) + : nativeImage.createFromPath(linuxIcon), webPreferences: { spellcheck: false, contextIsolation: true, @@ -118,7 +120,7 @@ const createMainWindow = () => { }, }); - if (is.dev && process.env['ELECTRON_RENDERER_URL']) { + if (!app.isPackaged && process.env['ELECTRON_RENDERER_URL']) { mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL']) } else { mainWindow.loadFile(fileURLToPath(new URL('../renderer/index.html', import.meta.url))); diff --git a/src/main/modules/Tray.tsx b/src/main/modules/Tray.tsx index 25a3ebfb..57ebed73 100644 --- a/src/main/modules/Tray.tsx +++ b/src/main/modules/Tray.tsx @@ -1,7 +1,9 @@ -import { app, Menu, Tray } from 'electron'; +import { app, Menu, Tray, nativeImage } from 'electron'; +import { fileURLToPath } from 'url'; import { handleCreateWindow } from '../index'; import { config } from '../config'; import { setFile } from './File/File'; +import trayIcon from '../../../resources/tray/tray.png?asset' let tray: Tray; @@ -43,10 +45,8 @@ function createTray() { } const files: FileObject[] = config.get('files'); - const iconName: string = process.platform === 'win32' ? 'tray.ico' : 'tray.png'; const menu: Electron.Menu = Menu.buildFromTemplate(createMenuTemplate(files)); - - tray = new Tray(`./assets/icons/tray/${iconName}`); + tray = new Tray(nativeImage.createFromPath(trayIcon)) tray.setToolTip('sleek'); tray.setContextMenu(menu); tray.on('click', () => { diff --git a/src/renderer/Dialog/PomodoroPicker.tsx b/src/renderer/Dialog/PomodoroPicker.tsx index f490052c..a6931b27 100644 --- a/src/renderer/Dialog/PomodoroPicker.tsx +++ b/src/renderer/Dialog/PomodoroPicker.tsx @@ -1,7 +1,8 @@ import React from 'react'; import FormControl from '@mui/material/FormControl'; import TextField from '@mui/material/TextField'; -import TomatoIconDuo from '../../../assets/icons/tomato-duo.svg'; +//import TomatoIconDuo from '../../../assets/icons/tomato-duo.svg'; +import TomatoIconDuo from '../public/tomato-duo.svg?asset' import './PomodoroPicker.scss'; interface PomodoroPickerProps { diff --git a/src/renderer/Grid/Renderer.tsx b/src/renderer/Grid/Renderer.tsx index 9e14b8cf..8237e28d 100644 --- a/src/renderer/Grid/Renderer.tsx +++ b/src/renderer/Grid/Renderer.tsx @@ -5,7 +5,7 @@ import remarkGfm from 'remark-gfm' import Button from '@mui/material/Button'; import Chip from '@mui/material/Chip'; import Tooltip from '@mui/material/Tooltip'; -import TomatoIconDuo from '../../../assets/icons/tomato-duo.svg'; +import TomatoIconDuo from '../public/tomato-duo.svg?asset' import DatePickerInline from './DatePickerInline'; import OpenInNewIcon from '@mui/icons-material/OpenInNew'; import { handleLinkClick } from '../Shared'; diff --git a/assets/icons/tomato-duo.svg b/src/renderer/public/tomato-duo.svg similarity index 100% rename from assets/icons/tomato-duo.svg rename to src/renderer/public/tomato-duo.svg