Google Chrome was recently upgraded to version 35.0.1916.114 on my Ubuntu 14.04 installation.
Since then the notification icon has begun to show up on the system tray. However it seems it's using a low resolution icon – it looks distorted:
How can I fix/replace it?
Best Answer
Edit: see below for update on replacing notification icon
If you're chrome binaries are installed in the typical location, you'll find them in
/opt/google/chrome
. In that folder you should find the filechrome_100_percent.pak
which contains the notification icon. Here's the steps I used to extract it, using information from this stack overflow question:Checkout the code to the grit-i18n project with
svn checkout http://grit-i18n.googlecode.com/svn/trunk/ grit-i18n-read-only
This will give you a folder in your CWD called
grit-i18n-read-only
. CD into this foldercd grit-i18n-read-only
Copy the data_pack python module to this folder
cp grit/format/data_pack.py .
Edit
data_pack.py
in your preferred editor. After the initial imports, add the following line:sys.path.append(os.getcwd())
Towards the end of the file in the
main
function, remove the lineprint '%s: %s' % (resource_id, text)
(the Stack Overflow answer states this occurs at line 160, in my experience the current version has it at line 201)
In its place, insert the following lines indented appropriately (3 times):
file = open(str(resource_id), "wb")
file.write(text)
Run the
data_pack.py
utility on the chrome pak file (I copied it to thegrit-i18n-read-only
folder first):./data_pack.py ../chrome_100_percent.pak
This will result in a lot of new files in the current directory, all named as numbers with no extension. Your file browser (e.g. nautilus) should be able to determine the file types and show image thumbnails. I found the notification icons named as 6866 & 6867.
Edit
While there are some simpler answers below, I managed to hack together some code to re-package the resources which you could attempt after editing the icons. This would produce a new
.pak
file, which I haven't attempted to use myself, so I can't say for certain this would successfully result in new notification icons.In the main function in
data_pack.py
, I commented out all the code in theelse
block and added the following lines:Then, just run
./data_pack.py
. This assumeschrome_100_percent.pak
is in the current directory, and should give you a newchrome_100_percent_new.pak
file which you could attempt copying over/opt/google/chrome/chrome_100_percent.pak
.I believe some additional icons in the resource pak related to the notification icon have been identified; editing the above to include those should be pretty straightforward.
Final Edit
Now that I'm back home and had the chance to work on this some more, I managed to successfully replace chrome's notification icon. As @Glutanimate noted, you're stuck with 16x16 resolution, so I'm not sure how much improvement you can actually achieve, but I suppose that's subjective.
I simply opened the aforementioned icons (6864 - 6867) in GIMP, which detected them as Grayscale PNGs. I pasted a new icon into the same file in GIMP, thus attempting to keep the same image properties (e.g. grayscale). I then exported these as PNGs, unchecking ALL of the options that GIMP offers but maintaining a compression level of 9. The resulting files had .png extensions, so I removed those and replaced the originals. I then re-ran
data_pack.py
, having already made the modifications detailed above.I kept a backup copy of the original pak with
mv /opt/google/chrome/chrome_100_percent.pak /opt/google/chrome/chrome_100_percent.bak
and moved my modified .pak file in its place. I would make sure chrome is closed when doing this, and double-check that there are no chrome processes running, and I believe chrome has a new setting to allow background processes even when the browser is closed by default now.Lo and behold, my notification icons in Unity reflect my changes.
Finally-Final Edit: OK, I lied - I attempted a 32x32 PNG and it seems to have worked just fine. So, there you go. Here some result screenshots.
(Source: Batch icons from Adam Whitcroft)