-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Set Linux Icon #128
Comments
Ah we should probably mention in the readme then that linux dock icons aren't supported at this time |
Oh I got that backwards, it won't work in the file manager but it will work in the dock. |
Gahhhh
|
FYI, I've tried to make the section on icons & Linux clearer (with an extra note about file extensions in general, per @kfranqueiro) in 9ed594c. |
@malept ahhh excellent thanks! |
I am still having the same issue but on Xubuntu, I had it showing a icon at one point but now its not and I used the --icon= option and still not working. |
Per the |
@malept can you please give a example on how to do it on the BrowserWindow This is a snippet of my code |
This is an example of mine that I know works, because I use Xfce (although it's CoffeeScript, not JavaScript): https://github.com/malept/gmusicprocurator-app/blob/master/src/main.coffee#L14-L21 |
@malept I tried adding in icon = NativeImage.createFromPath("#{__dirname}/icon-48.png") so my code looks like this what do I do or do wrong? |
I did say it was in CoffeeScript, which has a different syntax from JavaScript and will not execute in Node unless it's transpiled into JavaScript. In your code, you want to do the following: // Put this line at the top
NativeImage = require('native-image');
// [...more of your code before the snippet you pasted...]
// Create the browser window.
mainWindow = new BrowserWindow ({'width': 1200, 'height': 900, icon: NativeImage.createFromPath(__dirname + '/icon.ico')});
// [...the rest of the snippet of code you pasted...] |
Ah right I see and I also see now I need another dependency "NativeImage" how do I get this? |
It is bundled with Electron. |
I added it and NativeImage = require('native-image'); above it but the icon still hasn't come up, I even changed '/icon.ico')}); to '/node_modules/icon.ico')}); This is my code |
I missed it before, you need to set a PNG, not an ICO. |
ok ill try that |
Awesome that worked thanks so much! |
I've done some testing on this and found out icons can work under certain conditions (Without using native images) which I detail at: |
This comment has been minimized.
This comment has been minimized.
You can place your icon somewhere inside
The app icon will automatically picked by your desktop environment, and this also helps icon-theme-packages overriding your app icon to provide a consistent customizable UI.
|
Am opening a separate issue here rather than carry on in #125.
I've not been able to set an icon for the packaged Linux version of my app. It's not documented and must work differently than OS X or Windows? In the other thread it was mentioned that you just need to set
icon
inBroswerWindow
, however, that doesn't work for me. Perhaps I'm missing something obvious?Either way it would be good to get it stated clearly so that we can add it to the documentation 📖
I set
icon
in myBrowserWindow
here. I've tried it both as aNativeImage
and as the path to the.png
viaiconPath
. I get the same results.When using
electron-packager
I'm running this npm script. I've tried it with the--icon
flag and without along with both variants of themain.js
code I mention ☝️I still do not get my icon as the app's icon in the file manager or in the dock:
Are there other formatting specifications like size or color type? My image is here.
The text was updated successfully, but these errors were encountered: