Skip to content

Commit e562713

Browse files
authored
Tray icon (#15)
* Make focus keep the same layout * Change issue template * Tray icon * Release 0.0.4
1 parent 11d1478 commit e562713

File tree

8 files changed

+41
-42
lines changed

8 files changed

+41
-42
lines changed

.github/ISSUE_TEMPLATE/1-Bug_report.md

+4-14
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,7 @@ labels: 'bug'
5151

5252
<!--- Include as many relevant details about the environment you experienced the bug in -->
5353

54-
- Node version :
55-
- electron-react-boilerplate version or branch :
56-
- Operating System and version :
57-
- Link to your project :
58-
59-
<!---
60-
❗️❗️ Also, please consider donating (https://opencollective.com/electron-react-boilerplate-594) ❗️❗️
61-
62-
Donations will ensure the following:
63-
64-
🔨 Long term maintenance of the project
65-
🛣 Progress on the roadmap
66-
🐛 Quick responses to bug reports and help requests
67-
-->
54+
- Node version:
55+
- PlainBelt version or branch:
56+
- Operating System and version:
57+
- Link to your project:

.github/ISSUE_TEMPLATE/2-Question.md

-10
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,3 @@ labels: 'question'
77
## Summary
88

99
<!-- What do you need help with? -->
10-
11-
<!---
12-
❗️❗️ Also, please consider donating (https://opencollective.com/electron-react-boilerplate-594) ❗️❗️
13-
14-
Donations will ensure the following:
15-
16-
🔨 Long term maintenance of the project
17-
🛣 Progress on the roadmap
18-
🐛 Quick responses to bug reports and help requests
19-
-->
+1-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
---
22
name: Feature request
3-
about: You want something added to the boilerplate. 🎉
3+
about: You want something added to PlainBelt. 🎉
44
labels: 'enhancement'
55
---
6-
7-
<!---
8-
❗️❗️ Also, please consider donating (https://opencollective.com/electron-react-boilerplate-594) ❗️❗️
9-
10-
Donations will ensure the following:
11-
12-
🔨 Long term maintenance of the project
13-
🛣 Progress on the roadmap
14-
🐛 Quick responses to bug reports and help requests
15-
-->

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
## Features
88

99
- [x] Multiple plain text tools
10+
- [x] Tray icon
1011
- [ ] Clipboard auto detection
11-
- [ ] Tray icon for quick action
12+
- [ ] Global hotkey
1213

1314
## Tools list
1415

src/App.global.css

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
}
99

1010
input {
11-
@apply rounded focus:ring-blue-500 focus:outline-none focus:ring-2;
11+
@apply rounded focus:ring-blue-500 focus:outline-none focus:ring-2 focus:ring-inset;
1212
}
1313

1414
textarea {
15-
@apply rounded focus:ring-blue-500 focus:outline-none focus:ring-2;
15+
@apply rounded focus:ring-blue-500 focus:outline-none focus:ring-2 focus:ring-inset;
1616
}
1717
}

src/components/Main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const Main = () => {
101101
{/* Left sidebar */}
102102
<nav className="flex flex-col w-1/4 overflow-x-hidden overflow-y-auto bg-gray-300">
103103
{/* Search */}
104-
<div className="flex items-center px-3 mx-3 mt-6 space-x-1 text-gray-400 bg-gray-200 rounded-md focus-within:text-gray-600 focus-within:ring-2 focus-within:ring-blue-500">
104+
<div className="flex items-center px-2 mx-3 mt-6 space-x-1 text-gray-400 bg-gray-200 rounded-md focus-within:text-gray-600 focus-within:ring-2 focus-within:ring-blue-500">
105105
<FontAwesomeIcon icon="search" />
106106
<input
107107
type="text"

src/main.dev.ts

+30-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,15 @@
1111
import 'core-js/stable';
1212
import 'regenerator-runtime/runtime';
1313
import path from 'path';
14-
import { app, BrowserWindow, dialog, ipcMain, shell } from 'electron';
14+
import {
15+
app,
16+
BrowserWindow,
17+
dialog,
18+
ipcMain,
19+
nativeTheme,
20+
shell,
21+
Tray,
22+
} from 'electron';
1523
import { autoUpdater } from 'electron-updater';
1624
import log from 'electron-log';
1725
import { FileFilter, IpcMainInvokeEvent } from 'electron/main';
@@ -29,6 +37,7 @@ export default class AppUpdater {
2937
}
3038

3139
let mainWindow: BrowserWindow | null = null;
40+
let tray = null;
3241

3342
if (process.env.NODE_ENV === 'production') {
3443
const sourceMapSupport = require('source-map-support');
@@ -115,6 +124,25 @@ const createWindow = async () => {
115124
new AppUpdater();
116125
};
117126

127+
const getIcon = () => {
128+
if (process.platform === 'win32') return '16x16.png';
129+
if (nativeTheme.shouldUseDarkColors) return '16x16.png';
130+
return '16x16.png';
131+
};
132+
133+
const createTray = async () => {
134+
tray = new Tray(path.join(__dirname, '../assets/icons', getIcon()));
135+
136+
tray.on('click', async () => {
137+
if (mainWindow == null) {
138+
await createWindow();
139+
}
140+
mainWindow?.show();
141+
});
142+
143+
tray.setToolTip('PlainBelt');
144+
};
145+
118146
/**
119147
* Handlers events from React
120148
*/
@@ -179,7 +207,7 @@ app.on('window-all-closed', () => {
179207
}
180208
});
181209

182-
app.whenReady().then(createWindow).catch(console.log);
210+
app.whenReady().then(createWindow).then(createTray).catch(console.log);
183211

184212
app.on('activate', () => {
185213
// On macOS it's common to re-create a window in the app when the

src/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "plainbelt",
33
"productName": "plainbelt",
4-
"version": "0.0.3",
4+
"version": "0.0.4",
55
"description": "A toolbelt for all your plain text",
66
"main": "./main.prod.js",
77
"author": {

0 commit comments

Comments
 (0)