mani-calc 1.1.0
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/ARCHITECTURE.md +249 -0
- package/CHANGELOG.md +69 -0
- package/COMPLETION_SUMMARY.md +304 -0
- package/CONTRIBUTING.md +110 -0
- package/EXAMPLES.md +220 -0
- package/LICENSE +21 -0
- package/OVERLAY_MODE.md +361 -0
- package/PUBLISHING_GUIDE.md +291 -0
- package/QUICKSTART.md +115 -0
- package/QUICK_PUBLISH.md +108 -0
- package/README.md +614 -0
- package/RELEASE_NOTES_v1.1.0.md +262 -0
- package/bin/cli.js +203 -0
- package/bin/overlay.js +46 -0
- package/package.json +47 -0
- package/src/core/clipboard-manager.js +40 -0
- package/src/core/history-manager.js +141 -0
- package/src/core/math-engine.js +95 -0
- package/src/core/nlp-parser.js +146 -0
- package/src/core/unit-converter.js +208 -0
- package/src/index.js +121 -0
- package/src/integration/windows-search.js +126 -0
- package/src/ui/floating-search.js +228 -0
- package/src/ui/overlay.html +254 -0
- package/test/test.js +133 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
# š Mani-Calc v1.1.0 - Overlay Mode Release!
|
|
2
|
+
|
|
3
|
+
## ⨠What's New
|
|
4
|
+
|
|
5
|
+
### šØ Overlay Mode - The Game Changer!
|
|
6
|
+
|
|
7
|
+
You asked for improvements, and we delivered! **Mani-Calc now has a beautiful floating search box** that appears anywhere on your screen with a simple keyboard shortcut!
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## š New Features
|
|
12
|
+
|
|
13
|
+
### 1. **Floating Search Box**
|
|
14
|
+
- Press **`Alt+Space`** anywhere in Windows
|
|
15
|
+
- Beautiful glassmorphism design
|
|
16
|
+
- Always-on-top overlay
|
|
17
|
+
- Auto-hide when you click outside
|
|
18
|
+
- Smooth animations
|
|
19
|
+
|
|
20
|
+
### 2. **System Commands**
|
|
21
|
+
Control your computer with simple commands:
|
|
22
|
+
|
|
23
|
+
| Command | Action |
|
|
24
|
+
|---------|--------|
|
|
25
|
+
| `sleep` | Put computer to sleep |
|
|
26
|
+
| `shutdown` | Shutdown computer |
|
|
27
|
+
| `restart` | Restart computer |
|
|
28
|
+
| `lock` | Lock computer |
|
|
29
|
+
| `logout` | Log out current user |
|
|
30
|
+
| `empty recycle bin` | Empty recycle bin |
|
|
31
|
+
| `volume up` | Increase volume |
|
|
32
|
+
| `volume down` | Decrease volume |
|
|
33
|
+
| `mute` | Mute volume |
|
|
34
|
+
| `unmute` | Unmute volume |
|
|
35
|
+
|
|
36
|
+
### 3. **Live Preview**
|
|
37
|
+
- See results as you type
|
|
38
|
+
- Instant feedback
|
|
39
|
+
- No need to press Enter for simple calculations
|
|
40
|
+
|
|
41
|
+
### 4. **Enhanced UI**
|
|
42
|
+
- Glassmorphism design (semi-transparent, blurred background)
|
|
43
|
+
- Smooth slide-down animations
|
|
44
|
+
- Color-coded results (success, error, system commands)
|
|
45
|
+
- Keyboard shortcuts displayed
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## š How to Use
|
|
50
|
+
|
|
51
|
+
### Start Overlay Mode
|
|
52
|
+
```bash
|
|
53
|
+
npm run overlay
|
|
54
|
+
|
|
55
|
+
# Or after global install
|
|
56
|
+
mani-calc-overlay
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Use the Hotkey
|
|
60
|
+
Press **`Alt+Space`** anywhere in Windows!
|
|
61
|
+
|
|
62
|
+
### Examples
|
|
63
|
+
```
|
|
64
|
+
Alt+Space ā "2 + 3 * 5" ā Enter
|
|
65
|
+
Result: ā 2 + 3 * 5 = 17
|
|
66
|
+
|
|
67
|
+
Alt+Space ā "10 km to miles" ā Enter
|
|
68
|
+
Result: ā 10 km = 6.21 miles
|
|
69
|
+
|
|
70
|
+
Alt+Space ā "sleep" ā Enter
|
|
71
|
+
Result: ā System going to sleep...
|
|
72
|
+
|
|
73
|
+
Alt+Space ā "lock" ā Enter
|
|
74
|
+
Result: ā Locking computer...
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## šÆ Why This is Amazing
|
|
80
|
+
|
|
81
|
+
### Before
|
|
82
|
+
1. Open Calculator app
|
|
83
|
+
2. Type calculation
|
|
84
|
+
3. Copy result
|
|
85
|
+
4. Switch back to work
|
|
86
|
+
|
|
87
|
+
### After
|
|
88
|
+
1. Press `Alt+Space`
|
|
89
|
+
2. Type calculation
|
|
90
|
+
3. Done! (result auto-copied)
|
|
91
|
+
|
|
92
|
+
**That's 3x faster!** ā”
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## š New Files
|
|
97
|
+
|
|
98
|
+
- `src/ui/floating-search.js` - Floating search box logic
|
|
99
|
+
- `src/ui/overlay.html` - Beautiful UI
|
|
100
|
+
- `bin/overlay.js` - Overlay mode entry point
|
|
101
|
+
- `OVERLAY_MODE.md` - Complete documentation
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## š§ Technical Details
|
|
106
|
+
|
|
107
|
+
### Stack
|
|
108
|
+
- **Electron** - For native window management
|
|
109
|
+
- **Global Shortcuts** - `Alt+Space` hotkey
|
|
110
|
+
- **IPC** - Communication between UI and backend
|
|
111
|
+
- **Glassmorphism CSS** - Modern, beautiful design
|
|
112
|
+
|
|
113
|
+
### Performance
|
|
114
|
+
- **Memory**: ~50-80 MB (Electron overhead)
|
|
115
|
+
- **CPU**: <1% when idle
|
|
116
|
+
- **Startup**: ~2 seconds
|
|
117
|
+
- **Response**: <100ms
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## š Comparison
|
|
122
|
+
|
|
123
|
+
| Feature | v1.0.0 | v1.1.0 |
|
|
124
|
+
|---------|--------|--------|
|
|
125
|
+
| **Windows Search** | ā
| ā
|
|
|
126
|
+
| **CLI** | ā
| ā
|
|
|
127
|
+
| **Interactive Mode** | ā
| ā
|
|
|
128
|
+
| **Overlay Mode** | ā | ā
NEW! |
|
|
129
|
+
| **System Commands** | ā | ā
NEW! |
|
|
130
|
+
| **Live Preview** | ā | ā
NEW! |
|
|
131
|
+
| **Global Hotkey** | ā | ā
NEW! |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## šØ UI Screenshots
|
|
136
|
+
|
|
137
|
+
The overlay features:
|
|
138
|
+
- **Glassmorphism design** - Semi-transparent with blur effect
|
|
139
|
+
- **Smooth animations** - Slide-down results
|
|
140
|
+
- **Color-coded feedback** - Green for success, red for errors, orange for system commands
|
|
141
|
+
- **Keyboard shortcuts** - Displayed at bottom
|
|
142
|
+
- **Auto-focus** - Input ready when you open it
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## šŗļø Roadmap Update
|
|
147
|
+
|
|
148
|
+
### ā
Completed (v1.1.0)
|
|
149
|
+
- [x] Floating search box overlay
|
|
150
|
+
- [x] Global hotkey support
|
|
151
|
+
- [x] System commands
|
|
152
|
+
- [x] Live preview
|
|
153
|
+
- [x] Glassmorphism UI
|
|
154
|
+
|
|
155
|
+
### š Coming Next (v1.2.0)
|
|
156
|
+
- [ ] Custom themes
|
|
157
|
+
- [ ] Plugin system
|
|
158
|
+
- [ ] File search integration
|
|
159
|
+
- [ ] Web search integration
|
|
160
|
+
- [ ] Clipboard history
|
|
161
|
+
- [ ] Multi-monitor support
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## š Documentation
|
|
166
|
+
|
|
167
|
+
All documentation has been updated:
|
|
168
|
+
|
|
169
|
+
- **README.md** - Added overlay mode section
|
|
170
|
+
- **OVERLAY_MODE.md** - NEW: Complete overlay guide
|
|
171
|
+
- **CHANGELOG.md** - v1.1.0 release notes
|
|
172
|
+
- **package.json** - Updated to v1.1.0
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## š Installation
|
|
177
|
+
|
|
178
|
+
### For New Users
|
|
179
|
+
```bash
|
|
180
|
+
npm install -g mani-calc
|
|
181
|
+
npm run overlay
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### For Existing Users
|
|
185
|
+
```bash
|
|
186
|
+
npm update -g mani-calc
|
|
187
|
+
npm run overlay
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## š” Tips & Tricks
|
|
193
|
+
|
|
194
|
+
### 1. Auto-Start on Boot
|
|
195
|
+
Add to Windows Startup folder for always-available calculator
|
|
196
|
+
|
|
197
|
+
### 2. Customize Hotkey
|
|
198
|
+
Edit `src/ui/floating-search.js` to change `Alt+Space` to your preference
|
|
199
|
+
|
|
200
|
+
### 3. Add Custom Commands
|
|
201
|
+
Edit `floating-search.js` to add your own system commands
|
|
202
|
+
|
|
203
|
+
### 4. Change Theme
|
|
204
|
+
Edit `overlay.html` CSS for dark mode or custom colors
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## šÆ Use Cases
|
|
209
|
+
|
|
210
|
+
### Quick Math While Working
|
|
211
|
+
```
|
|
212
|
+
Working in Excel ā Alt+Space ā "2500 * 0.15" ā Enter
|
|
213
|
+
Result copied ā Paste in Excel
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### System Control
|
|
217
|
+
```
|
|
218
|
+
Finishing work ā Alt+Space ā "lock" ā Enter
|
|
219
|
+
Computer locked instantly
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Unit Conversions
|
|
223
|
+
```
|
|
224
|
+
Reading recipe ā Alt+Space ā "2 cups to ml" ā Enter
|
|
225
|
+
Result: 473.18 ml
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## š¤ Community Feedback
|
|
231
|
+
|
|
232
|
+
This feature was inspired by your request! Keep the feedback coming:
|
|
233
|
+
- š Report bugs
|
|
234
|
+
- š” Suggest features
|
|
235
|
+
- ā Star the repo
|
|
236
|
+
- š¤ Contribute code
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## š What's Next?
|
|
241
|
+
|
|
242
|
+
We're listening to the community! Vote on features:
|
|
243
|
+
1. Custom themes?
|
|
244
|
+
2. Plugin system?
|
|
245
|
+
3. File search integration?
|
|
246
|
+
4. Web search integration?
|
|
247
|
+
|
|
248
|
+
[Open an issue](https://github.com/Maniredii/mani-calc/issues) to vote!
|
|
249
|
+
|
|
250
|
+
---
|
|
251
|
+
|
|
252
|
+
## š Thank You!
|
|
253
|
+
|
|
254
|
+
Thank you for using Mani-Calc and providing feedback. This overlay mode makes Windows productivity even better!
|
|
255
|
+
|
|
256
|
+
**Enjoy your new floating calculator!** ā”
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
**Version**: 1.1.0
|
|
261
|
+
**Release Date**: January 21, 2026
|
|
262
|
+
**Major Features**: Overlay Mode, System Commands, Live Preview
|
package/bin/cli.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const ManiCalc = require('../src/index');
|
|
4
|
+
const chalk = require('chalk');
|
|
5
|
+
const readline = require('readline');
|
|
6
|
+
|
|
7
|
+
const maniCalc = new ManiCalc();
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
const args = process.argv.slice(2);
|
|
11
|
+
|
|
12
|
+
// Handle protocol URLs (calc:query)
|
|
13
|
+
if (args.length > 0 && args[0].startsWith('calc:')) {
|
|
14
|
+
const query = maniCalc.windowsSearch.parseProtocolUrl(args[0]);
|
|
15
|
+
if (query) {
|
|
16
|
+
const result = await maniCalc.processQuery(query);
|
|
17
|
+
displayResult(result);
|
|
18
|
+
process.exit(0);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Handle direct query
|
|
23
|
+
if (args.length > 0) {
|
|
24
|
+
const query = args.join(' ');
|
|
25
|
+
|
|
26
|
+
// Special commands
|
|
27
|
+
if (query === 'install') {
|
|
28
|
+
await installService();
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (query === 'uninstall') {
|
|
33
|
+
await uninstallService();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (query === 'version' || query === '-v' || query === '--version') {
|
|
38
|
+
const pkg = require('../package.json');
|
|
39
|
+
console.log(chalk.cyan(`mani-calc v${pkg.version}`));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (query === 'help' || query === '-h' || query === '--help') {
|
|
44
|
+
displayHelp();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Process calculation
|
|
49
|
+
const result = await maniCalc.processQuery(query);
|
|
50
|
+
displayResult(result);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Interactive mode
|
|
55
|
+
await startInteractiveMode();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function installService() {
|
|
59
|
+
console.log(chalk.cyan('\nš§ Installing Mani-Calc...\n'));
|
|
60
|
+
|
|
61
|
+
const success = await maniCalc.initialize();
|
|
62
|
+
|
|
63
|
+
if (success) {
|
|
64
|
+
console.log(chalk.green('\nā Installation complete!'));
|
|
65
|
+
console.log(chalk.yellow('\nš Usage:'));
|
|
66
|
+
console.log(chalk.gray(' Type in Windows Search: calc: 2 + 3 * 5'));
|
|
67
|
+
console.log(chalk.gray(' Or use CLI: mani-calc "10 km to miles"'));
|
|
68
|
+
console.log(chalk.gray(' Interactive mode: mani-calc\n'));
|
|
69
|
+
} else {
|
|
70
|
+
console.log(chalk.red('\nā Installation failed. Please try running as administrator.\n'));
|
|
71
|
+
process.exit(1);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async function uninstallService() {
|
|
76
|
+
console.log(chalk.cyan('\nš§ Uninstalling Mani-Calc...\n'));
|
|
77
|
+
|
|
78
|
+
await maniCalc.shutdown();
|
|
79
|
+
|
|
80
|
+
console.log(chalk.green('ā Uninstallation complete!\n'));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function displayHelp() {
|
|
84
|
+
const pkg = require('../package.json');
|
|
85
|
+
|
|
86
|
+
console.log(chalk.cyan.bold(`\nš Mani-Calc v${pkg.version}`));
|
|
87
|
+
console.log(chalk.gray('Instant calculations from Windows Search\n'));
|
|
88
|
+
|
|
89
|
+
console.log(chalk.yellow('Usage:'));
|
|
90
|
+
console.log(' mani-calc [query] Calculate expression');
|
|
91
|
+
console.log(' mani-calc install Install Windows Search integration');
|
|
92
|
+
console.log(' mani-calc uninstall Uninstall integration');
|
|
93
|
+
console.log(' mani-calc Start interactive mode\n');
|
|
94
|
+
|
|
95
|
+
console.log(chalk.yellow('Examples:'));
|
|
96
|
+
console.log(chalk.gray(' Math:'));
|
|
97
|
+
console.log(' mani-calc "2 + 3 * 5"');
|
|
98
|
+
console.log(' mani-calc "sqrt(49)"');
|
|
99
|
+
console.log(' mani-calc "(10 + 20) / 5"\n');
|
|
100
|
+
|
|
101
|
+
console.log(chalk.gray(' Natural Language:'));
|
|
102
|
+
console.log(' mani-calc "what is 25 percent of 200"');
|
|
103
|
+
console.log(' mani-calc "half of 80"');
|
|
104
|
+
console.log(' mani-calc "square root of 64"\n');
|
|
105
|
+
|
|
106
|
+
console.log(chalk.gray(' Unit Conversions:'));
|
|
107
|
+
console.log(' mani-calc "10 km to miles"');
|
|
108
|
+
console.log(' mani-calc "5 kg to pounds"');
|
|
109
|
+
console.log(' mani-calc "100 celsius to fahrenheit"\n');
|
|
110
|
+
|
|
111
|
+
console.log(chalk.gray(' Special Commands:'));
|
|
112
|
+
console.log(' mani-calc history');
|
|
113
|
+
console.log(' mani-calc "clear history"\n');
|
|
114
|
+
|
|
115
|
+
console.log(chalk.yellow('Windows Search:'));
|
|
116
|
+
console.log(chalk.gray(' After installation, type in Windows Search:'));
|
|
117
|
+
console.log(chalk.gray(' calc: 2 + 3 * 5\n'));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function displayResult(result) {
|
|
121
|
+
if (result.type === 'error') {
|
|
122
|
+
console.log(chalk.red(`\nā ${result.formatted}\n`));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (result.type === 'history') {
|
|
127
|
+
console.log(chalk.cyan(`\n${result.formatted}\n`));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (result.type === 'info') {
|
|
132
|
+
console.log(chalk.blue(`\n${result.result}\n`));
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log(chalk.green(`\nā ${result.formatted}`));
|
|
137
|
+
console.log(chalk.gray(' (Result copied to clipboard)\n'));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function startInteractiveMode() {
|
|
141
|
+
console.log(chalk.cyan.bold('\nš Mani-Calc Interactive Mode'));
|
|
142
|
+
console.log(chalk.gray('Type your calculations or "help" for examples. Press Ctrl+C to exit.\n'));
|
|
143
|
+
|
|
144
|
+
const rl = readline.createInterface({
|
|
145
|
+
input: process.stdin,
|
|
146
|
+
output: process.stdout,
|
|
147
|
+
prompt: chalk.yellow('calc> ')
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
rl.prompt();
|
|
151
|
+
|
|
152
|
+
rl.on('line', async (line) => {
|
|
153
|
+
const query = line.trim();
|
|
154
|
+
|
|
155
|
+
if (!query) {
|
|
156
|
+
rl.prompt();
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (query === 'exit' || query === 'quit') {
|
|
161
|
+
console.log(chalk.cyan('\nš Goodbye!\n'));
|
|
162
|
+
process.exit(0);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (query === 'help') {
|
|
166
|
+
displayHelp();
|
|
167
|
+
rl.prompt();
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (query === 'clear') {
|
|
172
|
+
console.clear();
|
|
173
|
+
rl.prompt();
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const result = await maniCalc.processQuery(query);
|
|
178
|
+
displayResult(result);
|
|
179
|
+
|
|
180
|
+
rl.prompt();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
rl.on('close', () => {
|
|
184
|
+
console.log(chalk.cyan('\nš Goodbye!\n'));
|
|
185
|
+
process.exit(0);
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Handle errors gracefully
|
|
190
|
+
process.on('uncaughtException', (error) => {
|
|
191
|
+
console.error(chalk.red('\nā Error:'), error.message);
|
|
192
|
+
process.exit(1);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
process.on('unhandledRejection', (error) => {
|
|
196
|
+
console.error(chalk.red('\nā Error:'), error.message);
|
|
197
|
+
process.exit(1);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
main().catch((error) => {
|
|
201
|
+
console.error(chalk.red('\nā Error:'), error.message);
|
|
202
|
+
process.exit(1);
|
|
203
|
+
});
|
package/bin/overlay.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
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');
|
|
7
|
+
|
|
8
|
+
let maniCalc;
|
|
9
|
+
let floatingSearch;
|
|
10
|
+
|
|
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();
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Handle app quit
|
|
35
|
+
app.on('will-quit', () => {
|
|
36
|
+
if (floatingSearch) {
|
|
37
|
+
floatingSearch.destroy();
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Handle Ctrl+C
|
|
42
|
+
process.on('SIGINT', () => {
|
|
43
|
+
console.log(chalk.cyan('\n\nš Shutting down Mani-Calc Overlay...\n'));
|
|
44
|
+
app.quit();
|
|
45
|
+
process.exit(0);
|
|
46
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mani-calc",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Spotlight-style instant calculator for Windows Search | Math, natural language & unit conversions | Offline-first productivity tool",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mani-calc": "./bin/cli.js",
|
|
8
|
+
"mani-calc-overlay": "./bin/overlay.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node src/index.js",
|
|
12
|
+
"overlay": "electron bin/overlay.js",
|
|
13
|
+
"install-service": "node scripts/install-service.js",
|
|
14
|
+
"uninstall-service": "node scripts/uninstall-service.js",
|
|
15
|
+
"test": "node test/test.js"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"calculator",
|
|
19
|
+
"windows",
|
|
20
|
+
"search",
|
|
21
|
+
"math",
|
|
22
|
+
"productivity",
|
|
23
|
+
"spotlight",
|
|
24
|
+
"instant-calculation",
|
|
25
|
+
"unit-conversion"
|
|
26
|
+
],
|
|
27
|
+
"author": "Manideep Reddy Eevuri",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=14.0.0"
|
|
31
|
+
},
|
|
32
|
+
"os": [
|
|
33
|
+
"win32"
|
|
34
|
+
],
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"mathjs": "^12.2.1",
|
|
37
|
+
"node-windows": "^1.0.0-beta.8",
|
|
38
|
+
"clipboardy": "^3.0.0",
|
|
39
|
+
"chalk": "^4.1.2",
|
|
40
|
+
"electron": "^28.1.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/manireddy/mani-calc"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const clipboardy = require('clipboardy');
|
|
2
|
+
|
|
3
|
+
class ClipboardManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.autoCopy = true;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
async copy(text) {
|
|
9
|
+
if (!this.autoCopy) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
await clipboardy.write(String(text));
|
|
15
|
+
return true;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.error('Failed to copy to clipboard:', error);
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async read() {
|
|
23
|
+
try {
|
|
24
|
+
return await clipboardy.read();
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('Failed to read from clipboard:', error);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAutoCopy(enabled) {
|
|
32
|
+
this.autoCopy = enabled;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
isAutoCopyEnabled() {
|
|
36
|
+
return this.autoCopy;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports = ClipboardManager;
|