From 5a4684d3c6b43e45b241787cda64b354556e5b34 Mon Sep 17 00:00:00 2001 From: grunjol Date: Sun, 20 Mar 2016 12:47:55 -0300 Subject: [PATCH] add icon for linux desktop file --- main/register-handlers.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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: