Skip to content

Commit

Permalink
Version to 1.03
Browse files Browse the repository at this point in the history
+ Auto launch on start option in context menu
  • Loading branch information
tma02 committed May 6, 2016
1 parent f5f8817 commit 2fb16a2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
36 changes: 35 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
const menubar = require('menubar');
const electron = require('electron');
const AutoLaunch = require('auto-launch');

const Menu = electron.Menu;
const BrowserWindow = electron.BrowserWindow;
const mb = menubar();

mb.setOption('preload-window', true);
Expand All @@ -10,13 +13,44 @@ const spotify = require('./spotify.js');

const ipcMain = require('electron').ipcMain;

let settingsWindow;

var appLauncher = new AutoLaunch({
name: 'spotifymenubar'
});

const contextMenu = Menu.buildFromTemplate([
{ label: 'spotify-menubar', enabled: false },
//{ label: 'Settings', click: function() { /*TODO*/ } },
//{ label: 'Settings', click: function() { openSettings(); } },
{ label: 'Launch on Login', type: 'checkbox', checked: false, click: function(item) {
appLauncher.isEnabled().then(function(enabled) {
if (enabled) {
return appLauncher.disable().then(function() {
item.checked = false;
});
}
else {
return appLauncher.enable().then(function() {
item.checked = true;
});
}
});
} },
{ type: 'separator' },
{ label: 'Quit', click: function() { mb.app.quit(); } }
]);

appLauncher.isEnabled().then(function(enabled) {
contextMenu.items[1].checked = enabled;
});

function openSettings() {
settingsWindow = new BrowserWindow({width: 400, height: 500});
settingsWindow.on('closed', function () {
settingsWindow = null;
});
}

mb.on('ready', function ready() {
console.log('app is ready');
spotify.init();
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"name": "spotify-menubar",
"version": "1.0.0",
"version": "1.0.3",
"description": "A Spotify controller that lives in the menubar.",
"main": "index.js",
"dependencies": {
"auto-launch": "^2.0.1",
"font-awesome": "^4.6.1",
"menubar": "^4.1.0"
},
Expand Down

0 comments on commit 2fb16a2

Please sign in to comment.