-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindows.js
56 lines (46 loc) · 1.3 KB
/
windows.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
46
47
48
49
50
51
52
53
54
55
56
const { BrowserWindow, ipcMain, shell } = require("electron")
const { cleanClipboard, addClipboard } = require("./clipboard")
const createWindow = (options,path)=>{
let window = new BrowserWindow(options)
window.loadFile(path)
return window
}
exports.clipboardWindowActions = (app)=>{
ipcMain.on('clean',()=>{
cleanClipboard()
})
ipcMain.on('copy',(err,data)=>{
addClipboard(data)
})
ipcMain.on('settings',()=>{
this.settingsWindow(app)
})
}
exports.settingsWindow = (app)=>{
let window = createWindow({
width : 200,
height : 140,
title : "clipboard",
resizable: false,
fullScreen: false,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true
}
},"./views/settings.html")
window.webContents.once('dom-ready',()=>{
window.webContents.send('isAutoLaunchEnabled', app.getLoginItemSettings().openAtLogin)
})
ipcMain.on('switchAutoLaunch',(err,data)=>{
app.setLoginItemSettings({
openAtLogin: data
})
})
ipcMain.on('github',()=>{
shell.openExternal("https://github.com/sschrs/clipboard")
})
window.on('closed',()=>{
window = null;
})
}