-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathmain.js
54 lines (41 loc) · 1.25 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
/*jslint node: true */
'use strict';
const electron = require('electron');
const { app, BrowserWindow, globalShortcut, ipcMain } = electron;
const Store = require('electron-store');
const store = new Store();
var win;
ipcMain.on('resize', (event, left, top, w, h) => {
win.setPosition(left, top);
win.setSize(w, h);
});
function createWindow() {
let win = new BrowserWindow({
frame: false,
transparent:true,
// focusable: false,
// type: 'desktop',
hasShadow: false,
});
win.loadURL('file://' + __dirname + '/app/index.html');
//win.setAlwaysOnTop(true, 'torn-off-menu');
win.setVisibleOnAllWorkspaces(true);
return win;
}
app.on('ready', function() {
win = createWindow();
if (store.get("hideIcon") == "hideIcon") {
//Yeah I know, I could have used a boolean, right? But now, I use strings. Why? Just compatibility with the settings panel. If you can figure out a way to makes this pretty, lemme know.
app.dock.hide();
}
globalShortcut.register('Alt+o', () => {
win.isVisible() ? win.hide() : win.show();
});
globalShortcut.register('Alt+Ctrl+i', () => {
win.webContents.openDevTools();
});
globalShortcut.register('Alt+i', () => {
win.focus();
});
});
// TODO: better chunkwm integration