Skip to content

Commit

Permalink
Added click event to tray
Browse files Browse the repository at this point in the history
  • Loading branch information
ransome1 committed Dec 12, 2023
1 parent f0a8893 commit bfcf948
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .erb/configs/webpack.config.main.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const configuration: webpack.Configuration = {
target: 'electron-main',

entry: {
main: path.join(webpackPaths.srcMainPath, 'main.ts'),
main: path.join(webpackPaths.srcMainPath, 'main.tsx'),
preload: path.join(webpackPaths.srcMainPath, 'preload.js'),
},

Expand Down
2 changes: 1 addition & 1 deletion flatpak/com.github.ransome1.sleek.appdata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<developer_name>Robin Ahle</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="2.0.3" date="2023-12-11"/>
<release version="2.0.3" date="2023-12-12"/>
</releases>
<url type="homepage">https://github.com/ransome1/sleek</url>
<url type="contact">https://github.com/ransome1/sleek/issues</url>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sleek",
"version": "2.0.3",
"main": "./src/main/main.ts",
"main": "./src/main/main.tsx",
"scripts": {
"build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"",
"build:dll": "cross-env NODE_ENV=development TS_NODE_TRANSPILE_ONLY=true webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.ts",
Expand Down
4 changes: 2 additions & 2 deletions src/main/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ configStorage.onDidAnyChange((newValue, oldValue) => {
});

configStorage.onDidChange('files', async (files: File[] | undefined) => {
if (files) {
mainWindow!.webContents.send('updateFiles', files);
if(files && mainWindow) {
mainWindow.webContents.send('updateFiles', files);
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/main/main.ts → src/main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const handleReadyToShow = async () => {
try {
if(files && Object.keys(files)?.length > 0) {
const response = createFileWatcher(files);
console.log('main.ts:', response);
console.log(response);
}
} catch (error: any) {
console.log(error);
Expand Down
5 changes: 4 additions & 1 deletion src/main/modules/Tray.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, Menu, Tray } from 'electron';
import { handleCreateWindow, mainWindow } from '../main';
import { handleCreateWindow } from '../main';
import { configStorage } from '../config';
import { getAssetPath, File } from '../util';
import { setFile } from './File/File';
Expand Down Expand Up @@ -52,6 +52,9 @@ function createTray() {
tray = new Tray(getAssetPath(`icons/tray/${iconName}`));
tray.setToolTip('sleek');
tray.setContextMenu(menu);
tray.on('click', () => {
handleCreateWindow();
});
}

export { createTray };

0 comments on commit bfcf948

Please sign in to comment.