mani-calc 1.1.0 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/overlay.js CHANGED
@@ -1,46 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { app } = require('electron');
4
- const ManiCalc = require('../src/index');
5
- const FloatingSearchBox = require('../src/ui/floating-search');
6
- const chalk = require('chalk');
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const electron = require('electron');
7
6
 
8
- let maniCalc;
9
- let floatingSearch;
7
+ const mainScript = path.join(__dirname, '../src/ui/main-electron.js');
10
8
 
11
- async function startOverlayMode() {
12
- console.log(chalk.cyan('\nšŸš€ Starting Mani-Calc Overlay Mode...\n'));
13
-
14
- // Initialize ManiCalc
15
- maniCalc = new ManiCalc();
16
-
17
- // Initialize Floating Search Box
18
- floatingSearch = new FloatingSearchBox(maniCalc);
19
- await floatingSearch.initialize();
20
-
21
- console.log(chalk.green('āœ“ Mani-Calc Overlay is running!'));
22
- console.log(chalk.yellow('\nšŸ“ Press Alt+Space to toggle the search box'));
23
- console.log(chalk.gray(' Press Ctrl+C to exit\n'));
24
- }
25
-
26
- // Handle app ready
27
- app.on('ready', startOverlayMode);
28
-
29
- // Prevent app from quitting when all windows are closed
30
- app.on('window-all-closed', (e) => {
31
- e.preventDefault();
9
+ const child = spawn(electron, [mainScript], {
10
+ stdio: 'inherit',
11
+ windowsHide: false
32
12
  });
33
13
 
34
- // Handle app quit
35
- app.on('will-quit', () => {
36
- if (floatingSearch) {
37
- floatingSearch.destroy();
38
- }
14
+ child.on('close', (code) => {
15
+ process.exit(code);
39
16
  });
40
17
 
41
- // Handle Ctrl+C
18
+ // Handle termination signals
42
19
  process.on('SIGINT', () => {
43
- console.log(chalk.cyan('\n\nšŸ‘‹ Shutting down Mani-Calc Overlay...\n'));
44
- app.quit();
20
+ child.kill('SIGINT');
21
+ process.exit(0);
22
+ });
23
+
24
+ process.on('SIGTERM', () => {
25
+ child.kill('SIGTERM');
45
26
  process.exit(0);
46
27
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mani-calc",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Spotlight-style instant calculator for Windows Search | Math, natural language & unit conversions | Offline-first productivity tool",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -35,7 +35,7 @@
35
35
  "dependencies": {
36
36
  "mathjs": "^12.2.1",
37
37
  "node-windows": "^1.0.0-beta.8",
38
- "clipboardy": "^3.0.0",
38
+ "clipboardy": "^2.3.0",
39
39
  "chalk": "^4.1.2",
40
40
  "electron": "^28.1.0"
41
41
  },
@@ -0,0 +1,44 @@
1
+ const { app } = require('electron');
2
+ const ManiCalc = require('../index');
3
+ const FloatingSearchBox = require('./floating-search');
4
+ const chalk = require('chalk');
5
+
6
+ let maniCalc;
7
+ let floatingSearch;
8
+
9
+ async function startOverlayMode() {
10
+ console.log(chalk.cyan('\nšŸš€ Starting Mani-Calc Overlay Mode...\n'));
11
+
12
+ // Initialize ManiCalc
13
+ maniCalc = new ManiCalc();
14
+
15
+ // Initialize Floating Search Box
16
+ floatingSearch = new FloatingSearchBox(maniCalc);
17
+ await floatingSearch.initialize();
18
+
19
+ console.log(chalk.green('āœ“ Mani-Calc Overlay is running!'));
20
+ console.log(chalk.yellow('\nšŸ“ Press Alt+Space to toggle the search box'));
21
+ console.log(chalk.gray(' Press Ctrl+C to exit\n'));
22
+ }
23
+
24
+ // Handle app ready
25
+ app.on('ready', startOverlayMode);
26
+
27
+ // Prevent app from quitting when all windows are closed
28
+ app.on('window-all-closed', (e) => {
29
+ e.preventDefault();
30
+ });
31
+
32
+ // Handle app quit
33
+ app.on('will-quit', () => {
34
+ if (floatingSearch) {
35
+ floatingSearch.destroy();
36
+ }
37
+ });
38
+
39
+ // Handle Ctrl+C
40
+ process.on('SIGINT', () => {
41
+ console.log(chalk.cyan('\n\nšŸ‘‹ Shutting down Mani-Calc Overlay...\n'));
42
+ app.quit();
43
+ process.exit(0);
44
+ });