mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
Merge pull request #160 from resin-io/feat/taskbar-progress
Show progress bar in dock/taskbar
This commit is contained in:
commit
fb0ec6d322
@ -25,6 +25,8 @@ const _ = require('lodash');
|
||||
const electron = require('electron');
|
||||
const shell = electron.remote.require('shell');
|
||||
const dialog = electron.remote.require('./src/dialog');
|
||||
const BrowserWindow = electron.remote.BrowserWindow;
|
||||
const currentWindow = BrowserWindow.fromId(1);
|
||||
|
||||
require('angular-ui-bootstrap');
|
||||
require('./browser/modules/track');
|
||||
@ -139,9 +141,20 @@ app.controller('AppController', function($q, $log, DriveScannerService, Selectio
|
||||
return self.writer.burn(image, drive, function(state) {
|
||||
self.state = state;
|
||||
$log.debug(`Progress: ${self.state.progress}% at ${self.state.speed} MB/s`);
|
||||
|
||||
// Show progress inline in operating system task bar
|
||||
currentWindow.setProgressBar(self.state.progress / 100);
|
||||
|
||||
}).then(function() {
|
||||
$log.debug('Done!');
|
||||
}).catch(dialog.showError);
|
||||
}).catch(dialog.showError).finally(function() {
|
||||
|
||||
// Remove progress bar from task bar
|
||||
// Passing 0 or null/undefined doesn't do
|
||||
// the trick for Electron for some reason.
|
||||
currentWindow.setProgressBar(-1);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
this.open = shell.openExternal;
|
||||
|
Loading…
x
Reference in New Issue
Block a user