mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-23 03:06:38 +00:00
Show progress bar in dock/taskbar
This commit is contained in:
parent
adef5a5f7b
commit
9aac1cd4be
@ -25,6 +25,8 @@ const _ = require('lodash');
|
|||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const shell = electron.remote.require('shell');
|
const shell = electron.remote.require('shell');
|
||||||
const dialog = electron.remote.require('./src/dialog');
|
const dialog = electron.remote.require('./src/dialog');
|
||||||
|
const BrowserWindow = electron.remote.BrowserWindow;
|
||||||
|
const currentWindow = BrowserWindow.fromId(1);
|
||||||
|
|
||||||
require('angular-ui-bootstrap');
|
require('angular-ui-bootstrap');
|
||||||
require('./browser/modules/track');
|
require('./browser/modules/track');
|
||||||
@ -139,9 +141,20 @@ app.controller('AppController', function($q, $log, DriveScannerService, Selectio
|
|||||||
return self.writer.burn(image, drive, function(state) {
|
return self.writer.burn(image, drive, function(state) {
|
||||||
self.state = state;
|
self.state = state;
|
||||||
$log.debug(`Progress: ${self.state.progress}% at ${self.state.speed} MB/s`);
|
$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() {
|
}).then(function() {
|
||||||
$log.debug('Done!');
|
$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;
|
this.open = shell.openExternal;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user