-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
45 lines (30 loc) · 918 Bytes
/
main.js
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
const { app,BrowserWindow,globalShortcut,ipcMain,clipboard } = require('electron')
var win;var codes;var havij_i = 0;
const createWindow = () =>
{
win = new BrowserWindow
({
width: 800,
height: 800,
icon: "images/i.png",
webPreferences: {nodeIntegration: true,contextIsolation: false,},
autoHideMenuBar: true,
})
ipcMain.on('hi', function(e,data){codes = data;havij_i = 0;clipboard.writeText(codes[havij_i++]);});
ipcMain.on('bye', function(e,data){codes = [];havij_i = 0;clipboard.writeText("");});
win.loadFile('index.html');
}
app.whenReady().then(() =>
{
createWindow();
const ret = globalShortcut.register('CommandOrControl+B', () =>
{
if(codes[havij_i])
{
clipboard.writeText(codes[havij_i]);
if(codes[havij_i+1]) havij_i++;
win.webContents.send('move_forward', 'Hola');
}
else clipboard.writeText("");
});
});