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:
24
main.js
24
main.js
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user