Skip to content

Commit

Permalink
v1.9.91
Browse files Browse the repository at this point in the history
  • Loading branch information
sidneys committed Jan 10, 2017
1 parent 3a73797 commit a7a43d3
Show file tree
Hide file tree
Showing 31 changed files with 989 additions and 1,059 deletions.
13 changes: 9 additions & 4 deletions .appveyor.yml
Expand Up @@ -39,14 +39,13 @@ install:


build_script:
- cmd: npm run-script build win32
- cmd: npm run-script build

test: off

artifacts:
- path: build\release\*.exe


- path: build\output\win\*.exe

deploy:
- provider: GitHub
tag: v$(PACKAGE_VERSION)
Expand All @@ -65,3 +64,9 @@ notifications:
on_build_success: false
on_build_failure: true
on_build_status_changed: true
- provider: Webhook
url: https://updates-desktop-dimmer.herokuapp.com/webhook
method: POST
on_build_success: true
on_build_failure: false
on_build_status_changed: false
1 change: 1 addition & 0 deletions .jshintrc
Expand Up @@ -8,6 +8,7 @@
"immed": false,
"indent": 4,
"latedef": true,
"loopfunc": true,
"noarg": true,
"quotmark": "single",
"undef": true,
Expand Down
19 changes: 15 additions & 4 deletions .travis.yml
Expand Up @@ -16,13 +16,23 @@ branches:

env:
global:
- ARTIFACTS_DIRECTORY="build/release/"
- ARTIFACTS_DIRECTORY="build/output/"

cache:
directories:
- "$HOME/.electron"
- "./node_modules"

addons:
apt:
packages:
- icnsutils
- gcc-multilib
- g++-multilib
- graphicsmagick
- rpm
- xz-utils

before_install:
- curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | NVM_DIR=$HOME/.nvm sh
- source $HOME/.nvm/nvm.sh
Expand All @@ -36,7 +46,7 @@ before_script:
- echo "Deploying artifacts from $ARTIFACTS_DIRECTORY"

script:
- npm run build $TRAVIS_OS_NAME
- npm run-script build

after_success:
- npm run-script deploy:github
Expand All @@ -45,6 +55,7 @@ notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/a1a9de50af1c703bfe6c
on_success: change
on_failure: always
- https://updates-desktop-dimmer.herokuapp.com/webhook
on_success: always
on_failure: never
on_start: never
4 changes: 2 additions & 2 deletions README.md
@@ -1,7 +1,7 @@
# Desktop Dimmer [![Beta](https://img.shields.io/badge/status-alpha-blue.svg?style=flat)]() [![TravisCI](http://img.shields.io/travis/sidneys/desktop-dimmer.svg?style=flat)](http://travis-ci.org/sidneys/desktop-dimmer) [![AppVeyor](https://ci.appveyor.com/api/projects/status/d69sb6iav7tnrldq?svg=true)](https://ci.appveyor.com/project/sidneys/desktop-dimmer) [![npm](https://img.shields.io/npm/v/desktop-dimmer.svg?style=flat)](https://npmjs.com/package/desktop-dimmer)
# Desktop Dimmer [![Beta](https://img.shields.io/badge/status-alpha-blue.svg?style=flat)]() [![travis](http://img.shields.io/travis/sidneys/desktop-dimmer.svg?style=flat)](http://travis-ci.org/sidneys/desktop-dimmer) [![appveyor](https://ci.appveyor.com/api/projects/status/oc57pq7hfslqg3ru?svg=true)](https://ci.appveyor.com/project/sidneys/desktop-dimmer) [![npm](https://img.shields.io/npm/v/desktop-dimmer.svg?style=flat)](https://npmjs.com/package/desktop-dimmer) [![dependencies](https://img.shields.io/david/sidneys/desktop-dimmer.svg?style=flat-square)](https://npmjs.com/package/desktop-dimmer) [![devDependencies](https://img.shields.io/david/dev/sidneys/desktop-dimmer.svg?style=flat-square)](https://npmjs.com/package/desktop-dimmer)

<p align="center">
<img height="250px" src="https://raw.githubusercontent.com/sidneys/desktop-dimmer/release/resources/graphics/icon-app.png"/><br><br>
<img height="250px" src="https://raw.githubusercontent.com/sidneys/desktop-dimmer/release/resources/graphics/icon.png"/><br><br>
<b>Enable darker-than-dark dimming for internal and external screens.</b><br>
Available for macOS, Windows and Linux (Beta).
</p>
Expand Down
19 changes: 7 additions & 12 deletions app/es6-init.js
Expand Up @@ -15,22 +15,17 @@ const path = require('path');
* @global
* @constant
*/
const appRootPath = require('app-root-path').path;
const appRootPath = require('app-root-path');
const electronCompile = require('electron-compile');


/**
* Get Name of active NPM Script
* @global
* Set Application Root
*/
let npmScript = process.env['npm_lifecycle_event'];
appRootPath.setPath(path.join(__dirname, '..'));

if (npmScript && npmScript.includes('dev')) {
process.env.NODE_ENV = 'dev';
}

if (npmScript && npmScript.includes('livereload')) {
process.env.NODE_ENV = 'livereload';
}

electronCompile.init(appRootPath, './scripts/components/application');
/**
* Init
*/
electronCompile.init(appRootPath.path, './scripts/components/application');
2 changes: 1 addition & 1 deletion app/html/controller.html
Expand Up @@ -13,7 +13,7 @@

<div class="window-controls">
<a class="button settings" href="#">settings</a>
<a class="button exit" href="#">exit_to_app</a>
<a class="button exit" href="#">close</a>
</div>
</div>

Expand Down
80 changes: 42 additions & 38 deletions app/scripts/components/application.js
Expand Up @@ -45,24 +45,27 @@ const electronConnect = require('electron-connect');
* @global
* @constant
*/

const packageJson = require(path.join(appRootPath, 'package.json'));
const platformHelper = require(path.join(appRootPath, 'lib', 'platform-helper'));
const overlayManager = require(path.join(appRootPath, 'app', 'scripts', 'components', 'overlay-manager'));
const trayMenu = require(path.join(appRootPath, 'app', 'scripts', 'menus', 'tray-menu'));
const logger = require(path.join(appRootPath, 'lib', 'logger'))({ writeToFile: true });
const isDebug = require(path.join(appRootPath, 'lib', 'is-debug'));
const isLivereload = require(path.join(appRootPath, 'lib', 'is-livereload'));
/* jshint ignore:start */
const screenManager = require(path.join(appRootPath, 'app', 'scripts', 'components', 'screen-manager'));
const preferencesWindow = require(path.join(appRootPath, 'app', 'scripts', 'windows', 'preferences-window'));
const updaterService = require(path.join(appRootPath, 'app', 'scripts', 'services', 'updater-service'));
/* jshint ignore:end */

/**
* URLS
* @global
*/
const controllerUrl = url.format({ protocol: 'file:', pathname: path.join(appRootPath, 'app', 'html', 'controller.html') });

/**
* Debug Mode
* @global
*/
const liveReload = global.liveReload = (process.env.NODE_ENV === 'livereload');
const devMode = global.devMode = ((process.env.NODE_ENV === 'dev') || liveReload);
const controllerUrl = url.format({
protocol: 'file:', pathname: path.join(appRootPath, 'app', 'html', 'controller.html')
});

/**
* App
Expand Down Expand Up @@ -90,36 +93,16 @@ const appMenubar = menubar({
preloadWindow: true,
icon: appTrayIconEnabled,
index: controllerUrl,
alwaysOnTop: devMode === true,
alwaysOnTop: isDebug === true,
backgroundColor: platformHelper.isMacOS ? null : '#404040',
vibrancy: 'dark',
hasShadow: false
});

/**
* Init Settings
*/
let initializeSettings = () => {
// Settings Defaults
electronSettings.defaults(settingsDefaults);
electronSettings.applyDefaultsSync();

// Update Settings
electronSettings.setSync('internal.currentVersion', appVersion);

// Settings Configuration
electronSettings.configure({
prettify: true,
atomicSaving: true
});

console.log('Initialized Settings Database', electronSettings.getSettingsFilePath());
console.log(util.inspect(electronSettings.getSync(), true, null, true));
};

/**
* Settings Defaults
* @property {String} internal.currentVersion - Application Version
* @property {Boolean} internal.updatePending - Hashmap
* @property {Object} internal.overlays - Hashmap
* @property {Number} display.id- Play Notification Sound
* @property {Number} display.alpha - Autostart
Expand All @@ -135,12 +118,31 @@ let settingsDefaults = {
}
};

/**
* Init Settings
*/
let initializeSettings = () => {
// Settings Defaults
electronSettings.defaults(settingsDefaults);
electronSettings.applyDefaultsSync();

// Settings Configuration
electronSettings.configure({
prettify: true,
atomicSaving: true
});

logger.log('settings', `settingsFilePath: '${electronSettings.getSettingsFilePath()}'`);
logger.debug('settings', util.inspect(electronSettings.getSync()));
};


/**
* @listens app#quit
*/
app.on('quit', () => {
console.log('Updated Settings', util.inspect(electronSettings.getSync(), true, null, true));
logger.log('settings', `settingsFilePath: '${electronSettings.getSettingsFilePath()}'`);
logger.debug('settings', util.inspect(electronSettings.getSync()));
});

/**
Expand All @@ -151,20 +153,22 @@ app.on('ready', () => {

initializeSettings();
overlayManager.create();
//preferencesWindow.create();

if (platformHelper.isLinux) {
trayMenu.add(appMenubar.tray);
}

// DEBUG
if (devMode) {
appMenubar.window.webContents.openDevTools({ mode: 'undocked' });
logger.log('application', 'ready');

// DEBUG
if (isDebug) {
appMenubar.window.webContents.openDevTools({ mode: 'detach' });
}
if (liveReload) {
appMenubar.window.webContents.openDevTools({ mode: 'undocked' });
if (isLivereload) {
appMenubar.window.webContents.openDevTools({ mode: 'detach' });
const electronConnectClient = electronConnect.client;
electronConnectClient.add();
electronConnectClient.create();
}
});

Expand All @@ -186,5 +190,5 @@ appMenubar.on('show', () => {
* @listens ipcMain#log
*/
ipcMain.on('log', (event, message) => {
console.log(message);
logger.log('renderer', message);
});

0 comments on commit a7a43d3

Please sign in to comment.