-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
66 lines (52 loc) · 2.08 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { app, BrowserWindow, globalShortcut, screen } from 'electron';
import path from 'path'
import { fileURLToPath } from 'url';
let win;
function createWindow() {
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
win = new BrowserWindow({
resizable: false,
moveable: false,
roundedCorners: 500,
frame: false,
x: Math.floor(width - 390),
y: 5,
width: width * 0.2,
height: Math.floor(height * 0.993),
icon: path.join(__dirname, 'assets', 'logo.ico'),
webPreference: {
nodeIntegration: true
}
});
win.loadURL('https://edgeservices.bing.com/edgesvc/chat?udsframed=1&form=SHORUN&clientscopes=chat,noheader,udsedgeshop,channelbeta,ntpquery,devtoolsapi,udsinwin11,udsdlpconsent,udscstart,cspgrd,&shellsig=b975e0cc5a474706873839a00fcbbcdabcd6c864&setlang=en-US&darkschemeovr=1&udsps=0&udspp=0');
win.setAlwaysOnTop(true)
}
app.whenReady().then(() => {
globalShortcut.register('Alt+Shift+C', () => {
if (win.isVisible()) {
win.hide();
} else {
win.show();
}
})
globalShortcut.register('Alt+Shift+D', () => {
const currentURL = win.webContents.getURL();
if (currentURL.includes('edgeservices')) {
win.loadURL('https://chatgpt.com');
} else {
win.loadURL('https://edgeservices.bing.com/edgesvc/chat?udsframed=1&form=SHORUN&clientscopes=chat,noheader,udsedgeshop,channelbeta,ntpquery,devtoolsapi,udsinwin11,udsdlpconsent,udscstart,cspgrd,&shellsig=b975e0cc5a474706873839a00fcbbcdabcd6c864&setlang=en-US&darkschemeovr=1&udsps=0&udspp=0')
}
})
}).then(createWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
});
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});