Commit Graph

789 Commits

Author SHA1 Message Date
FabulousCupcake d0a0614ba3 Add --browserwindow-options to completely expose Electron options (PR #835)
This adds a new flag `--browserwindow-options`, taking a stringified JSON object as input.  
It will be inserted directly into the options when BrowserConfig is initialized.

This allows total configurability of the electron BrowserWindow configuration via nativefier.

An example use case is added to the documentation, which modifies the default font family in the browser.

#### References

- https://github.com/electron/electron/blob/master/docs/api/browser-window.md#new-browserwindowoptions
  - See the following for electron v3.1.7
  - https://github.com/electron/electron/blob/v3.1.7/docs/api/browser-window.md#new-browserwindowoptions
2019-08-22 21:37:49 +02:00
Umair Ahmed 81c422d4e0 Support setting background color (fixes #795) (PR #819)
Adds a `--background-color` flag for the background of the window when the app isn't loaded.
2019-08-22 21:25:58 +02:00
Nate Woolls 5433569921 Support macOS 10.4+ Dark Mode, default to Electron 5.x (#796)
Introduces a `--darwin-dark-mode-support` flag. 
(I kept the same flag used by Electron Packager.)
This required bumping Electron and Electron Packager.

Addresses:

- https://github.com/jiahaog/nativefier/issues/733
- https://github.com/jiahaog/nativefier/issues/727
2019-08-22 21:05:39 +02:00
Adrian DC b959956a38 Squirrel: resolve .quit() issue with missing ../screen (PR #784)
* As explained in: https://github.com/electron/electron/issues/8862#issuecomment-294303518
    an issue with .quit() exists with a "Cannot find module '../screen'" issue,
    while using the .exit() alternative avoids the issue

* Validated on Windows with the same logic as #744 where the issue recently appeared
2019-04-19 13:21:36 -04:00
Ronan Jouchet 070efe6fa9 Update changelog for `v7.6.12` 2019-03-25 19:14:25 -04:00
Ronan Jouchet 5cdfe96cbe Bump default electron to 3.1.7 2019-03-25 11:19:33 -04:00
Ying 479611ecc4 Fix crash when launching a second instance using option --single-instance (Fixes #664)
This refactors the deprecated call to `app.makeSingleInstance()`.
See [electron / app.requestSingleInstanceLock()](https://electronjs.org/docs/all?q=app.requestSingleInstanceLock).
2019-03-25 11:16:28 -04:00
Anas Emad a27bb0fd35 Prevent menu from opening on Alt+Shift, by defining Alt+... menu shortcuts (#768)
On Linux if you try to change the keyboard layout with Alt + Shift,
the menu will pop up. Shortcuts are needed because Electron opens
the first menu on pressing `Alt` if no hotkey is assigned.

[Similar issue in RocketChat](https://github.com/RocketChat/Rocket.Chat.Electron/issues/50)
2019-03-17 11:29:15 -04:00
Ronan Jouchet 07faeb1881 Update changelog for `v7.6.11` 2019-02-10 22:20:40 -05:00
Ronan Jouchet 726f44d266 Bump default Electron to 3.1.3 2019-02-09 21:46:15 -05:00
Adrian DC 5b6cc89f22 Fix #316: Add --clear-cache flag to cleanup session on start/exit ("incognito" mode) (PR #747)
- Add a new `clearCache` option and `--clear-cache` parameter
  to trigger session cleanups upon window launch and close

- Covers the feature request from issue #316 

- Use case example: Forcing authentification / login between sessions without limiting cache size
2019-02-08 10:03:29 -05:00
Ronan Jouchet 85aacaaa52
Doc for squirrel installers 2019-02-08 09:59:20 -05:00
Adrian DC 310d63e397 Support packaging nativefier applications into Squirrel-based installers (#744)
[Squirrel](https://github.com/Squirrel/Squirrel.Windows) is *"an installation and update
framework for Windows desktop apps "*.

This PR adds `electron-squirrel-startup`, allowing to package nativefier applications 
into squirrel-based setup installers. Squirrel require this entrypoint to perform
desktop and startup menu creations, without showing the UI on setup launches.

- References: https://github.com/mongodb-js/electron-squirrel-startup

- Resolves `electron-winstaller` and `electron-installer-windows` support of desktop / startup menu shortcuts for nativefier packaged applications.

- The `electron-squirrel-startup` entrypoint has no effect on both Linux and Darwin, only on Windows

- Supporting it directly inside `nativefier` avoids having to "hack" around the existing `main.js`
  and including dependencies from `electron-squirrel-startup` in an intermediate package
  to be included in a third layer for the final installer executable

- The following script based on both `nativefier` and `electron-winstaller` templates
   represents a portable proof of concept for this merge request :

```js
var nativefier = require('nativefier').default;
var electronInstaller = require('electron-winstaller');

var options = {
  name: 'Web WhatsApp',
  targetUrl: 'http://web.whatsapp.com',
  platform: 'windows',
  arch: 'x64',
  version: '0.36.4',
  out: '.',
  overwrite: false,
  asar: false,
  counter: false,
  bounce: false,
  width: 1280,
  height: 800,
  showMenuBar: false,
  fastQuit: false,
  userAgent: 'Mozilla ...',
  ignoreCertificate: false,
  ignoreGpuBlacklist: false,
  enableEs3Apis: false,
  insecure: false,
  honest: false,
  zoom: 1.0,
  singleInstance: false,
  fileDownloadOptions: {
    saveAs: true
  },
  processEnvs: {
    GOOGLE_API_KEY: '<your-google-api-key>'
  }
};

nativefier(options, function(error, appPath) {
  if (error) {
    console.error(error);
    return;
  }
  console.log('App has been nativefied to', appPath);

  resultPromise = electronInstaller.createWindowsInstaller({
    appDirectory: 'Web WhatsApp-win32-x64',
    outputDirectory: './',
    authors: 'Web WhatsApp',
    exe: 'Web WhatsApp.exe'
  });

  resultPromise.then(() => console.log('It worked!'), e => console.log(`No dice: ${e.message}`));
});
```
2019-02-08 09:57:32 -05:00
Dword 3588f8a85f Icon conversion: don't crash if source/destination paths have spaces (PR #736) 2019-01-09 10:08:17 -05:00
Ronan Jouchet c722f8a5ac Update changelog for `v7.6.10` 2019-01-01 23:44:57 -05:00
Ronan Jouchet d6b4b23f0a Bump default Electron to 3.0.13 2019-01-01 23:42:50 -05:00
Dominic Hopton e064f765cb Fix CSS & JavaScript injection (Fixes #703, Fixes #731, PR #732)
* Fix for CSS Injection not working (#703)

Issue:
When using `onHeadersReceived`, the code was passing `null` for the filters.
This appears to trigger behaviour that matches _no_ urls at all.
This results in it never being called to inject the CSS.

Fix:
Pass an empty array instead. Now it's called for all URLs.

Tests pass & linting is clean

* Fix JavaScript injection (#731)

Issue:
It appears that on low endd evices (Core m3 MacBook), the attachment to
`DOMContentLoaded` happens _after_ the event has been raised, so does
not have a chance to inject the script.

Fix:
Move the attachment to the top of the file -- before the imports. This
triggers a bunch of linting erros, so also added disablement inplace.

Additional:
Clarified when the injected JS gets loaded, and what it can assume about
the DOM.
2019-01-01 23:38:45 -05:00
Robert Barat 9acd85bb65 README: fix typo (#723) 2018-12-14 08:37:08 -05:00
Ronan Jouchet ae3eafe653 Update changelog for `v7.6.9` 2018-12-01 14:07:47 -05:00
Felix Eckhofer 8600c78d1a Add --start-in-tray CLI flag to let app start in background (PR #564, Fixes #522) 2018-12-01 14:04:55 -05:00
Ronan Jouchet 1f6e74b1e3
README: fix broken link to changelog 2018-12-01 00:21:32 -05:00
Ronan Jouchet d3a6acc22d Let Jest install its own regenerator-runtime dep
See: https://jestjs.io/docs/en/getting-started
Note: Explicitly installing regenerator-runtime is not needed if you use npm 3 or 4 or Yarn
2018-12-01 00:15:13 -05:00
Ronan Jouchet cb7e17b8e3 Bump default Electron to 3.0.10 2018-11-30 23:42:28 -05:00
Luccas Clezar 114b4a9724 Fix CSS injection broken with Electron 3 (PR #709, Fixes #703)
See Electron 3.0 breaking API changes:
https://electronjs.org/blog/electron-3-0#breaking-api-changes

  [#12477] https://github.com/electron/electron/pull/12477
           refactor: removed `did-get-response-details` and `did-get-redirect-request events`
2018-11-30 21:14:20 -05:00
Ronan Jouchet 038812cd46
Travis: add Node.js 11 run 2018-11-30 21:09:17 -05:00
Ronan Jouchet 5bee4710e3
Fix ESLint contradiction between CodeClimate & npm run ci task
CodeClimate is drunk, it says it runs eslint, but
yields different results from the eslint task.

Disabling it in codeclimate.
2018-11-30 20:53:02 -05:00
Benedikt Rötsch 3029cba01f Support global shortcuts that trigger input events (PR #698, Fixes #15)
This adds a new flag, allowing the user to define global shortcuts that trigger input events within the main window.

That way, I could easily wrap SoundCloud and Deezer to create a native app which reacts on my keyboard media buttons.
2018-11-04 21:03:52 -05:00
Hugo Locurcio 35c66b02b5 Update documentation URLs in the CLI help message (#683)
This updates URLs in the command-line help to avoid redirects.
2018-10-26 21:45:19 -04:00
Ronan Jouchet 11644e34d8 Update changelog for `v7.6.8` 2018-10-06 22:20:21 -04:00
Ronan Jouchet 0f88a761de Bump default electron to 3.0.3, deps (eslint-plugin-prettier) 2018-10-06 22:13:47 -04:00
Kevin Jalbert c974014465 Remove mention to older badge option in docs (#693)
The `--counter` option mentioned a _badge option_, which doesn't appear in the docs. This change removes this as it is not relevant in the context.
2018-10-02 14:15:29 -04:00
André Werlang ad2f47df9c Update docs about icon requirements on Windows (#663)
On Windows, the supplied icon needs to be in .ico format
2018-08-22 16:18:46 -04:00
Sascha Ißbrücker 27ea3fc4a3 Show application window on notification click (#640) 2018-08-22 16:06:44 -04:00
Ronan Jouchet e228f0cff8 Bump default Electron to 2.0.8, upgrade dep 2018-08-22 16:01:45 -04:00
Ronan Jouchet 7aae5084d1 Bump default electron to 2.0.7 2018-08-08 19:55:32 -04:00
Ronan Jouchet 2b8f1390fb Update changelog for `v7.6.7` 2018-07-31 21:29:04 -04:00
Ronan Jouchet d99c7bec1f Bump electron to 2.0.6 2018-07-31 21:17:59 -04:00
Ronan Jouchet 0c9ef088a5 Fix broken --version 2018-07-31 20:29:26 -04:00
Ronan Jouchet 38edc9191e README: document node 4 is not supported/tested 2018-07-22 13:27:18 -04:00
Goh Jia Hao 93a9833c47 Update npm token
Tokens were invalidated in https://status.npmjs.org/incidents/dn7c1fgrr7ng
2018-07-22 09:55:51 -07:00
Ronan Jouchet eb23217766 README: link to bugs and feature requests, cleanup 2018-07-22 11:49:50 -04:00
Ronan Jouchet 94efbc44c4 Update changelog for `v7.6.6` 2018-07-22 10:44:44 -04:00
Ronan Jouchet b31be18303 Update changelog for `v7.6.5` 2018-07-21 09:23:03 -04:00
Ronan Jouchet 19561e9ad6 Make eslint happy 2018-07-21 09:16:02 -04:00
Ronan Jouchet bbef14ccc6 Bump default Electron to 2.0.5, upgrade deps 2018-07-21 08:58:53 -04:00
chocolateboy 22ef3d39b6 Fix doc typo (#656) 2018-07-20 12:29:37 -04:00
Ronan Jouchet 1b66fcd8c8 Bump default Electron to 2.0.4 2018-07-10 15:54:26 -04:00
David Kramer c065cad01a Fix #633 - "Copy Current URL" causing TypeError(#634)
When the `getCurrentUrl` function was refactored to make use of the `withFocusedWindow` function in ac99c6424d, it stopped returning a value and broke the "Copy Current URL" feature (#633).

This change restores the original behavior of the getCurrentURL function and makes the "Copy Current URL" feature functional again.
2018-06-14 08:06:30 -04:00
Goh Jia Hao 0b47999c3e Fix lint error 2018-06-10 11:07:06 -07:00
Goh Jia Hao 147a02743a Add jest --watch helper for npm scripts 2018-06-10 11:00:22 -07:00