File size: 1,270 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
const { app } = require( 'electron' );
const log = require( '../../../lib/logger' )( 'platform:linux' );
/**
*
* Module variables
*/
let window;
function LinuxPlatform( appWindow ) {
window = appWindow.window;
app.on( 'activate', function () {
log.info( 'Window activated' );
window.show();
window.focus();
} );
app.on( 'window-all-closed', function () {
log.info( 'All windows closed, shutting down' );
app.quit();
} );
window.on( 'close', function () {
app.quit();
} );
}
LinuxPlatform.prototype.restore = function () {
if ( window.isMinimized() ) {
window.restore();
}
window.show();
};
LinuxPlatform.prototype.showNotificationsBadge = function ( count ) {
// Linux: updating badge count requires Unity launcher
// https://www.electronjs.org/docs/api/app#appsetbadgecountcount-linux-macos
if ( ! app.isUnityRunning() ) {
log.info( `Unity not running, skipping badge update (unseenCount: ${ count })` );
return;
}
const badgeCount = app.getBadgeCount();
if ( badgeCount === count ) {
return;
}
app.setBadgeCount( count );
};
LinuxPlatform.prototype.clearNotificationsBadge = function () {
app.setBadgeCount( 0 );
};
LinuxPlatform.prototype.setDockMenu = function () {
// no op
};
module.exports = LinuxPlatform;
|