Unpack icon files so setting browserWindow.icon works
This commit is contained in:
@@ -41,6 +41,10 @@ var all = {
|
|||||||
// require().
|
// require().
|
||||||
asar: true,
|
asar: true,
|
||||||
|
|
||||||
|
// A glob expression, that unpacks the files with matching names to the
|
||||||
|
// "app.asar.unpacked" directory.
|
||||||
|
'asar-unpack': 'WebTorrent*',
|
||||||
|
|
||||||
// The build version of the application. Maps to the FileVersion metadata property on
|
// The build version of the application. Maps to the FileVersion metadata property on
|
||||||
// Windows, and CFBundleVersion on OS X. We're using the short git hash (e.g. 'e7d837e')
|
// Windows, and CFBundleVersion on OS X. We're using the short git hash (e.g. 'e7d837e')
|
||||||
// Windows requires the build version to start with a number :/ so we stick on a prefix
|
// Windows requires the build version to start with a number :/ so we stick on a prefix
|
||||||
@@ -81,7 +85,7 @@ var darwin = {
|
|||||||
'helper-bundle-id': 'io.webtorrent.app.helper',
|
'helper-bundle-id': 'io.webtorrent.app.helper',
|
||||||
|
|
||||||
// Application icon.
|
// Application icon.
|
||||||
icon: path.join(__dirname, '..', 'static', 'WebTorrent.icns')
|
icon: config.APP_ICON + '.icns'
|
||||||
}
|
}
|
||||||
|
|
||||||
var win32 = {
|
var win32 = {
|
||||||
@@ -114,7 +118,7 @@ var win32 = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// Application icon.
|
// Application icon.
|
||||||
icon: path.join(__dirname, '..', 'static', 'WebTorrent.ico')
|
icon: config.APP_ICON + '.ico'
|
||||||
}
|
}
|
||||||
|
|
||||||
var linux = {
|
var linux = {
|
||||||
@@ -151,7 +155,7 @@ function buildDarwin (cb) {
|
|||||||
infoPlist.CFBundleDocumentTypes = [
|
infoPlist.CFBundleDocumentTypes = [
|
||||||
{
|
{
|
||||||
CFBundleTypeExtensions: [ 'torrent' ],
|
CFBundleTypeExtensions: [ 'torrent' ],
|
||||||
CFBundleTypeIconFile: 'WebTorrentFile.icns',
|
CFBundleTypeIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
|
||||||
CFBundleTypeName: 'BitTorrent Document',
|
CFBundleTypeName: 'BitTorrent Document',
|
||||||
CFBundleTypeRole: 'Editor',
|
CFBundleTypeRole: 'Editor',
|
||||||
LSHandlerRank: 'Owner',
|
LSHandlerRank: 'Owner',
|
||||||
@@ -169,7 +173,7 @@ function buildDarwin (cb) {
|
|||||||
infoPlist.CFBundleURLTypes = [
|
infoPlist.CFBundleURLTypes = [
|
||||||
{
|
{
|
||||||
CFBundleTypeRole: 'Editor',
|
CFBundleTypeRole: 'Editor',
|
||||||
CFBundleURLIconFile: 'WebTorrentFile.icns',
|
CFBundleURLIconFile: path.basename(config.APP_FILE_ICON) + '.icns',
|
||||||
CFBundleURLName: 'BitTorrent Magnet URL',
|
CFBundleURLName: 'BitTorrent Magnet URL',
|
||||||
CFBundleURLSchemes: [ 'magnet' ]
|
CFBundleURLSchemes: [ 'magnet' ]
|
||||||
}
|
}
|
||||||
@@ -178,7 +182,7 @@ function buildDarwin (cb) {
|
|||||||
infoPlist.NSHumanReadableCopyright = config.COPYRIGHT
|
infoPlist.NSHumanReadableCopyright = config.COPYRIGHT
|
||||||
|
|
||||||
fs.writeFileSync(infoPlistPath, plist.build(infoPlist))
|
fs.writeFileSync(infoPlistPath, plist.build(infoPlist))
|
||||||
cp.execSync(`cp ${webTorrentFileIconPath} ${resourcesPath}`)
|
cp.execSync(`cp ${config.APP_FILE_ICON + '.icns'} ${resourcesPath}`)
|
||||||
|
|
||||||
if (cb) cb(null)
|
if (cb) cb(null)
|
||||||
})
|
})
|
||||||
|
|||||||
12
config.js
12
config.js
@@ -2,7 +2,8 @@ var applicationConfigPath = require('application-config-path')
|
|||||||
var path = require('path')
|
var path = require('path')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
APP_ICON: path.join(__dirname, 'static', 'WebTorrent.png'),
|
APP_FILE_ICON: path.join(pathToStatic(), 'WebTorrentFile'),
|
||||||
|
APP_ICON: path.join(pathToStatic(), 'WebTorrent'),
|
||||||
APP_NAME: 'WebTorrent',
|
APP_NAME: 'WebTorrent',
|
||||||
|
|
||||||
CONFIG_PATH: applicationConfigPath('WebTorrent'),
|
CONFIG_PATH: applicationConfigPath('WebTorrent'),
|
||||||
@@ -26,6 +27,9 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isProduction () {
|
function isProduction () {
|
||||||
|
if (!process.versions.electron) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (process.platform === 'darwin') {
|
if (process.platform === 'darwin') {
|
||||||
return !/\/Electron\.app\/Contents\/MacOS\/Electron$/.test(process.execPath)
|
return !/\/Electron\.app\/Contents\/MacOS\/Electron$/.test(process.execPath)
|
||||||
}
|
}
|
||||||
@@ -36,3 +40,9 @@ function isProduction () {
|
|||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pathToStatic () {
|
||||||
|
return isProduction()
|
||||||
|
? path.join(process.resourcesPath, 'app.asar.unpacked', 'static')
|
||||||
|
: path.join(__dirname, 'static')
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function createMainWindow () {
|
|||||||
autoHideMenuBar: true, // Hide top menu bar unless Alt key is pressed (Windows, Linux)
|
autoHideMenuBar: true, // Hide top menu bar unless Alt key is pressed (Windows, Linux)
|
||||||
backgroundColor: '#282828',
|
backgroundColor: '#282828',
|
||||||
darkTheme: true, // Forces dark theme (GTK+3)
|
darkTheme: true, // Forces dark theme (GTK+3)
|
||||||
icon: config.APP_ICON,
|
icon: config.APP_ICON + '.png',
|
||||||
minWidth: 375,
|
minWidth: 375,
|
||||||
minHeight: 38 + (120 * 2), // header height + 2 torrents
|
minHeight: 38 + (120 * 2), // header height + 2 torrents
|
||||||
show: false, // Hide window until DOM finishes loading
|
show: false, // Hide window until DOM finishes loading
|
||||||
|
|||||||
Reference in New Issue
Block a user