1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

popup will emit ipc event for main process to write clipboard

This commit is contained in:
Rokt33r
2015-06-06 21:31:43 +09:00
parent bacccbadf3
commit 010ee6a711
3 changed files with 29 additions and 8 deletions

24
main.js
View File

@@ -12,6 +12,10 @@ app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
var robot = require('robotjs')
var clipboard = require('clipboard')
var Tray = require('tray')
var appIcon = null
@@ -19,7 +23,13 @@ app.on('ready', function () {
appIcon = new Tray('./icon.png')
appIcon.setToolTip('This is my application.')
mainWindow = new BrowserWindow({width: 800, height: 600})
mainWindow = new BrowserWindow({
width: 800,
height: 600,
'web-preferences': {
'overlay-scrollbars': true
}
})
mainWindow.loadUrl('file://' + __dirname + '/electron_build/index.html')
@@ -36,7 +46,10 @@ app.on('ready', function () {
width: 600,
height: 400,
show: false,
frame: false
frame: false,
'web-preferences': {
'overlay-scrollbars': true
}
})
popUpWindow.loadUrl('file://' + __dirname + '/electron_build/electron/popup/index.html')
@@ -74,6 +87,13 @@ app.on('ready', function () {
ipc.on('hidePopUp', function () {
hidePopUp()
})
ipc.on('writeCode', function (e, code) {
clipboard.writeText(code)
// setTimeout(function () {
// robot.typeString(code)
// }, 200)
hidePopUp()
})
var fromMain
// Register a 'ctrl+x' shortcut listener.