diff --git a/README.md b/README.md index 551a25c..d8c97ef 100644 --- a/README.md +++ b/README.md @@ -10,23 +10,22 @@ Simply a fork with a small layer of abstraction on top of [electron-packager](ht I did this because I was tired of having to `⌘-tab or alt-tab` to my browser and then search through the numerous tabs open when I was using [Whatsapp Web](http://web.whatsapp.com) or [Facebook Messenger](http://messenger.com). ### Notes - +*Tested only on OSX, but should work for windows and linux* +#### Back Button A back button is intentionally not provided because the tool is designed for single page apps. However, if desired, an executable can built for any url, and simply pressing the `backspace` key will take the user back to the previous page. -*Tested only on OSX* - ## Installation ```bash # for use from cli -npm install nativefier -g +$ npm install nativefier -g ``` ## Usage ``` -Usage: nativefier --target= --platform= --arch= --version= +Usage: nativefier --platform= --arch= --version= Required options @@ -63,19 +62,36 @@ version-string should contain a hash of the application metadata to be embed - ProductVersion - ProductName - InternalName +badge if the target app should show badges in the OSX dock on receipt of desktop notifications ``` See [electron-packager](https://github.com/maxogden/electron-packager) for more details. + +#### OSX Dock Badge + +On OSX, it is desired for the App dock icon to show a badge on the receipt of a desktop notification. + +There is no known way to intercept and set an event listener for a desktop notification triggered by the [``](https://github.com/atom/electron/blob/master/docs/api/web-view-tag.md), the current workaround is to listen for `document.title` changes within the ``. Typical web apps like Facebook Messenger will change the `document.title` to "John sent a message..." on the receipt of a desktop notification, and this is what we will listen for to trigger the app badge on the dock. + +However, this would cause issues when the command line argument `target` is set to a external page which is not a single page app, because clicking on hyperlinks and switching pages would naturally change the `document.title`. Hence, `--badge` is an optional command argument that can be set by the user if the side effect of this workaround is understood. + ## Examples -Creating a native wrapper of `http://messenger.com` for `OSX x64`: +Creating an native wrapper for Facebook Messenger with the following arguments: + +- App Name: `Messenger` +- Target Url: `http://messenger.com` +- Platform: `darwin` (OSX) +- Architecture: `x64` +- Electron Version: `0.29.1` +- Override existing app (if any) +- OSX dock badges on (See notes above) ```bash -$ nativefier Messenger --platform=darwin --arch=x64 --version=0.29.1 --target='http://messenger.com' --overwrite +$ nativefier Messenger http://messenger.com --platform=darwin --arch=x64 --version=0.29.1 --overwrite --badge ``` ## Todo - Set the app icon from a url in the CLI -- Set the app window dimensions from the CLI -- Dock badges \ No newline at end of file +- Set the app window dimensions from the CLI \ No newline at end of file diff --git a/cli.js b/cli.js index 1ed44db..6b5190c 100755 --- a/cli.js +++ b/cli.js @@ -9,6 +9,7 @@ var tempDir = require('./tempDir'); args.dir = 'blah'; // set to true first args.name = args._[0]; +args.target = args._[1]; var protocolSchemes = [].concat(args.protocol || []); var protocolNames = [].concat(args['protocol-name'] || []); diff --git a/usage.txt b/usage.txt index 5df0f60..5e40e24 100644 --- a/usage.txt +++ b/usage.txt @@ -1,4 +1,4 @@ -Usage: nativefier --target= --platform= --arch= --version= +Usage: nativefier --platform= --arch= --version= Required options @@ -34,4 +34,5 @@ version-string should contain a hash of the application metadata to be embed - FileVersion - ProductVersion - ProductName - - InternalName \ No newline at end of file + - InternalName +badge if the target app should show badges in the OSX dock on receipt of desktop notifications \ No newline at end of file