Skip to content

Commit

Permalink
Restructuring, switching to Electron's nativeImage, removed broken DM…
Browse files Browse the repository at this point in the history
…G background image
  • Loading branch information
ransome1 committed Jan 14, 2025
1 parent f2a4bf1 commit 1583af6
Show file tree
Hide file tree
Showing 19 changed files with 22 additions and 17 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,7 @@ dist/

mas/

build/
build/

entitlements.mas.inherit.plist
entitlements.mas.plist
Binary file removed assets/dmg/background.tiff
Binary file not shown.
Binary file removed assets/icons/tray/tray.ico
Binary file not shown.
7 changes: 3 additions & 4 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,7 +27,6 @@ mac:
artifactName: ${productName}-${version}-mac-${arch}.${ext}
darkModeSupport: true
dmg:
background: assets/dmg/background.tiff
contents:
- x: 130
'y': 220
Expand All @@ -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}
Expand All @@ -60,7 +59,7 @@ appx:
publisherDisplayName: ransome1
applicationId: RobinAhle.sleektodomanager
linux:
icon: assets/icons
icon: resources/icon
category: ProjectManagement
target:
- deb
Expand Down
File renamed without changes.
File renamed without changes.
Binary file added resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
14 changes: 8 additions & 6 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
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';
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<string, any | undefined> = {};
Expand Down Expand Up @@ -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,
Expand All @@ -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)));
Expand Down
8 changes: 4 additions & 4 deletions src/main/modules/Tray.tsx
Original file line number Diff line number Diff line change
@@ -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;

Expand Down Expand Up @@ -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', () => {
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/Dialog/PomodoroPicker.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/Grid/Renderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
File renamed without changes

0 comments on commit 1583af6

Please sign in to comment.