electron

Writing code inside sudo.exec in Electron App

杀马特。学长 韩版系。学妹 提交于 2019-12-11 03:03:22
问题 I need to execute code with admin rights at many places. I find sudo.exe and successfully prompt user for permission and password. I still could not figure out how exactly to use sudo.exe. As I am getting same error of permission denied while deleting a file that need admin permission. That is how my code looks like: const fs = require('fs') var sudo = require('sudo-prompt'); var options = { name: 'Electron', }; sudo.exec('echo hello', options, function(error, stdout, stderr) { if (error)

Electron paste value from clipboard

偶尔善良 提交于 2019-12-11 02:54:02
问题 I am playing with a small electron app to make a simple copy/paste method. I have registered a hotkey using globalShortcut : globalShortcut.register(mod + '+' + key, () => { clipboard.writeText(content); // Paste content to any input field/app }); Is it possible for to now go to notepad and press the registered modifier to paste the content? Example: App loads, registers a shortcut which sets the clipboard with their desired text. They then go to a form where they want to paste this content

electron-packager and gloabl electron module

爱⌒轻易说出口 提交于 2019-12-11 02:49:56
问题 I have installed electron and electron-packager, all of them in global mode. When I build my app electron-packager searchs the local electron module. How forcing electron-packager to use the global electron module that I have installed? 回答1: The short answer is that what you have described isn't the way you "should" use electron-packager. Normally, the intent is that you are building a local package (exe or such) under the project directory you are working on. For example, an electron/angular

“Uncaught Error: Received packet in the wrong sequence” with devtools off - Electron + MySQL node driver + Webpack

喜你入骨 提交于 2019-12-11 02:17:04
问题 When I set up a new project using Electron + Webpack + node MySQL my production build is throwing: Uncaught Error: Received packet in the wrong sequence The error goes away only if I keep: config.devtools = 'eval' in my production builds, apparently this will result in a larger file size and some performance issues which I would like to avoid. Why my project / mysql module crashes with devtools set to '' ?? I can hardly find similar reports, am I the only one having this issue? webpack.config

How to set the devTools window position in electron

孤街浪徒 提交于 2019-12-11 01:59:57
问题 I got this from the docs app.on('ready', function(){ devtools = new BrowserWindow() window = new BrowserWindow({width:800, height:600}) window.loadURL(path.join('file://', __dirname, 'static/index.html')) window.webContents.setDevToolsWebContents(devtools.webContents) window.webContents.openDevTools({mode: 'detach'}) }) It opens two windows, on is the dev tools. But it's exactly underneath the main window. Is there a way to get them side by side (the screen is big enough)? 回答1: Once you've

Electron enable touch events for a touch screen

﹥>﹥吖頭↗ 提交于 2019-12-11 01:47:07
问题 I have a Raspberry Pi connected to touchscreen and running an electron app on it through the startx command, # startx ./electron-app -- --nocursor the problem that I can't handle the touch events like (touchstart, touchend) and apparently that is because Electron (or chromium) not seeing the screen as a touch screen. 回答1: The problem is not that Electron/Blink isn't seeing the touchscreen / native touch events. There are two parts to the problem, as I understand it: You need to ensure you're

Nightmare / Electron : Navigation Error (code - 118)

我与影子孤独终老i 提交于 2019-12-11 01:28:08
问题 Scraping with nightmare has been a breeze until recently , i started encountering errors with no details and the title "navigation error" and the error code 118 as shown below. { [Error: navigation error] '0': { message: 'navigation error', code: -118, details: '', url: 'http://markets.ft.com/research/Browse-Companies' }, length: 1, errors: [ { message: 'navigation error', code: -118, details: '', url: 'http://markets.ft.com/research/Browse-Companies' } ] } My nightmare code (Node.Js) :

How can I get information about the file that launched my app?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 00:48:02
问题 Similar to How to get the arguments for opening file with electron app but the solution there is not working for me. Using: OS - Windows 10 Electron - https://github.com/castlabs/electron-releases.git#v1.8.7-vmp1010 electron-builde - v20.28.3 I have a an electron app build with electron-builder, and using the latter I have specified a custom file association, .custom . So when you double-click on a file with this extension, file.custom , the installed app opens. This file would have some data

could not install electron in windows 10

孤街浪徒 提交于 2019-12-11 00:16:06
问题 Hi I am trying to install electron in my windows system using this following commands. - npm install -g electron - npm install electron - npm install electron --save-dev For all these command I am getting the following error. C:\Users\abc\Desktop\final\new>electron@ 'electron@' is not recognized as an internal or external command, operable program or batch file. C:\Users\abc\Desktop\final\new>npm install electron > electron@1.6.6 postinstall C:\Users\abc\Desktop\final\new\node_modules

PhantomJS from Node on Windows

人盡茶涼 提交于 2019-12-11 00:00:45
问题 I have written a Electron application using Node, Electron Boilerplate, and phantom. It works perfectly fine for me on my linux machine, I copied the source over to Windows 10, and ran with npm start , and all goes smoothly. However, when I try to build the application with the boilerplate module using npm run release , things go a little less smoothly. I can install and open the application just fine, but when I click the button that activates the phantom module, the windows goes all white