-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
55 lines (46 loc) · 1.5 KB
/
main.js
File metadata and controls
55 lines (46 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// main.js
const { app, BrowserWindow, ipcMain, dialog } = require('electron');
const path = require('path');
const { sendFeedbackEmail } = require('./feedbackHandler');
// const nodemailer = require('nodemailer');
const { organizeFiles } = require('./organize');
function createWindow() {
const win = new BrowserWindow({
width: 1000,
height: 700,
icon: path.join(__dirname, 'icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
},
});
win.setMenuBarVisibility(false); // Hide top menu bar (ribbon)
win.setMenu(null); // Disable all menu functionality
win.loadFile('index.html');
}
app.whenReady().then(createWindow);
ipcMain.handle('select-folder', async () => {
const result = await dialog.showOpenDialog({
properties: ['openDirectory']
});
return result.canceled ? null : result.filePaths[0];
});
ipcMain.handle('start-organize', async (event, { folderPath, exceptions }) => {
try {
organizeFiles(folderPath, exceptions);
return "✅ Organization Complete.";
} catch (err) {
return "❌ Error: " + err.message;
}
});
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit();
});
ipcMain.handle('send-feedback', async (event, data) => {
try {
await sendFeedbackEmail(data);
return { success: true };
} catch (err) {
console.error("❌ Feedback email failed:", err);
return { success: false, message: err.message };
}
});