diff --git a/main/register-handlers.js b/main/register-handlers.js index cce2e20d..a9a21902 100644 --- a/main/register-handlers.js +++ b/main/register-handlers.js @@ -7,6 +7,7 @@ module.exports = function () { } if (process.platform === 'linux') { installDesktopFile() + installDesktopIcon() } } @@ -27,6 +28,19 @@ function installDesktopFile () { fs.writeFileSync(desktopFilePath, desktopFile) } +function installDesktopIcon () { + var config = require('../config') + var fs = require('fs') + var path = require('path') + var os = require('os') + + var iconStaticPath = path.join(config.STATIC_PATH, 'WebTorrent.png') + var iconFile = fs.readFileSync(iconStaticPath) + + var iconFilePath = path.join(os.homedir(), '.local', 'share', 'icons', 'webtorrent.png') + fs.writeFileSync(iconFilePath, iconFile) +} + /** * To add a protocol handler on Windows, the following keys must be added to the Windows * registry: