Skip to content

Commit

Permalink
Merge pull request #1 from jersonlatorre/develop
Browse files Browse the repository at this point in the history
v0.7.2 - Bugs fixed & Code reorganized
  • Loading branch information
jersonlatorre authored Mar 21, 2021
2 parents 234a179 + 650353f commit 47ccbbc
Show file tree
Hide file tree
Showing 9 changed files with 237 additions and 187 deletions.
11 changes: 6 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"problemMatcher": [],
"label": "npm: start",
"detail": "node_modules/.bin/electron .",
"label": "start",
"type": "shell",
"command": "node_modules/.bin/electron .",
"windows": {
"command": ""
},
"group": {
"kind": "build",
"isDefault": true
Expand Down
170 changes: 0 additions & 170 deletions index.js

This file was deleted.

95 changes: 95 additions & 0 deletions ipc-main/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
const { app, BrowserWindow, globalShortcut, ipcMain } = require('electron')
const MainWindow = require('./main-window')

let mainWindow


/**
* Create the main window and manage its events
*/
function createWindow() {
mainWindow = new MainWindow()

ipcMain.on('mousedown', (e, position) => {
mainWindow.onMouseDown(position)
})

ipcMain.on('mouseup', (e) => {
mainWindow.onMouseUp()
})

ipcMain.on('mousemove', (e, position) => {
mainWindow.onMouseMove(position)
})

ipcMain.on('dblclick', (e) => {
mainWindow.onDoubleClick()
})

ipcMain.on('renderer-loaded', () => {
mainWindow.update()
})

globalShortcut.register('CommandOrControl+Alt+F', () => {
mainWindow.toggleFullScreen()
})

globalShortcut.register('CommandOrControl+Alt+1', () => {
mainWindow.decreaseOpacity()
})

globalShortcut.register('CommandOrControl+Alt+2', () => {
mainWindow.increaseOpacity()
})

globalShortcut.register('Ctrl+Alt+Q', () => {
app.quit()
})

globalShortcut.register('Ctrl+Esc', () => {
app.quit()
})

globalShortcut.register('Ctrl+Alt+H', () => {
mainWindow.toggleHide()
})
}


/**
* Prevents multiple instances of main window
*/
const gotTheLock = app.requestSingleInstanceLock()

if (!gotTheLock) {
app.quit()
} else {
app.on('second-instance', (event, commandLine, workingDirectory) => {
if (mainWindow) {
if (mainWindow.isMinimized()) mainWindow.restore()
mainWindow.focus()
}
})
}


/**
* App listeners
*/
app.on('ready', () => {
setTimeout(function() {
createWindow()
}, 1000)
})

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
Loading

0 comments on commit 47ccbbc

Please sign in to comment.