Skip to content

Commit

Permalink
Fix bug with show/focus
Browse files Browse the repository at this point in the history
  • Loading branch information
akovalyov committed Nov 16, 2015
1 parent 443d831 commit 555b490
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The short list is:

- [Shortcuts don't work in non-English layout](https://help.hipchat.com/forums/138883-suggestions-ideas/suggestions/4566565-non-english-layout-does-not-let-copy-paste)

- UI is not up to date compared to Web and OS X app.
- [UI is not up to date compared to Web and OS X app.](https://flowdock.uservoice.com/forums/36827-general/suggestions/5366511-add-a-linux-desktop-app)

#### Why not Chromium/Firefox app

Expand Down
9 changes: 2 additions & 7 deletions src/scripts/browser/app-tray.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,12 @@ class AppTray extends EventEmitter {
tray.setToolTip(settings.description);
tray.setContextMenu(contextMenu);
tray.on('clicked', function() {
var image = 'tray.png'
tray.setImage(path.resolve(__dirname, '..', '..', 'images', image));
global.application.markTrayClear();
global.application.onTrayClicked();
});

ipc.on('message:received', function(){
if(global.application.mainWindow.window.isFocused()){
return;
}
var image = 'tray-attention.png'
tray.setImage(path.resolve(__dirname, '..', '..', 'images', image));
global.application.markTrayNeedsAtention();
});

return tray;
Expand Down
6 changes: 5 additions & 1 deletion src/scripts/browser/app-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ class AppWindow extends EventEmitter {
this.hide();
});

browserWindow.on('show', function(){
this.focus();
});

return browserWindow;
}

Expand All @@ -69,7 +73,7 @@ class AppWindow extends EventEmitter {
*/
show() {
this.window.show();
this.window.focus();
this.focus();
}

/**
Expand Down
23 changes: 17 additions & 6 deletions src/scripts/browser/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,25 @@ class Application extends EventEmitter {
onTrayClicked() {
this.toggleVisibility();
}

markTrayNeedsAtention() {
if (this.mainWindow.window.isFocused()) {
return;
}
var image = 'tray-attention.png'
this.tray.tray.setImage(path.resolve(__dirname, '..', '..', 'images', image));
}
markTrayClear() {
var image = 'tray.png'
this.tray.tray.setImage(path.resolve(__dirname, '..', '..', 'images', image));
}
assignEvents(menu) {
// Handle application events
menu.on('application:quit', ::app.quit);
menu.on('application:focus', function(){
menu.on('application:focus', function() {
global.application.mainWindow.show();
});
menu.on('application:show-settings', function() {
});
menu.on('application:show-settings', function() {});

menu.on('application:open-url', function(menuItem) {
shell.openExternal(menuItem.url);
Expand All @@ -96,13 +107,13 @@ class Application extends EventEmitter {
})
.catch(::console.error);
});
menu.on('application:encrease-zoom', function(){
menu.on('application:encrease-zoom', function() {
global.application.mainWindow.window.webContents.send('zoom:encrease');
});
menu.on('application:decrease-zoom', function(){
menu.on('application:decrease-zoom', function() {
global.application.mainWindow.window.webContents.send('zoom:decrease');
});
menu.on('application:reset-zoom', function(){
menu.on('application:reset-zoom', function() {
global.application.mainWindow.window.webContents.send('zoom:reset');
});
// Handle window events
Expand Down
3 changes: 2 additions & 1 deletion tasks/pack.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ manifest = require '../src/package.json'
'--architecture ' + archName
'--rpm-os linux'
'--name ' + manifest.name
'--deb-no-default-config-files'
'--force' # Overwrite existing files
'--after-install ./build/resources/linux/after-install.sh'
'--after-remove ./build/resources/linux/after-remove.sh'
Expand Down Expand Up @@ -61,7 +62,7 @@ manifest = require '../src/package.json'

# Package the app

async.apply cp.exec, 'fpm ' + args.join(' ')
async.apply cp.exec, 'bundle exec fpm ' + args.join(' ')
], done

# Pack for all the platforms
Expand Down

0 comments on commit 555b490

Please sign in to comment.