Foggalong / hardcode-fixer

Fixes Hardcoded Icons
GNU General Public License v3.0
287 stars 49 forks source link

Google-Chrome hardcoded icon #63

Closed matteosecli closed 9 years ago

matteosecli commented 9 years ago

Please add Google Chrome support for its standard tray icon and for the notification tray icon (the bell-shaped one). They are hardcoded in /opt/google/chrome/chrome_100_percent.pak.

Thanks for your work! :)

Foggalong commented 9 years ago

Unfortunately it doesn't currently fix tray icons, but I'll leave this open in case that changes in future

bilelmoussaoui commented 9 years ago

I can try to modify the original script and make it works for the tray icons; its will help you fix too many tray icons: Telegram,Pushbullet,My-weather-indicator...

Foggalong commented 9 years ago

If you can that'd be great, but in it's such a messy job I'd be surprised if you can get it to work. They're hardcoded in so many different ways it's ridiculous :(

bilelmoussaoui commented 9 years ago

Well, you can at least fix the ones that use a specific folder for the icons. For example My-Weather-Indicator uses /opt/extras.ubuntu.com/my-weather-indicator/share/my-weather-indicator/icons for the normal and light icons. So for me, it's will be almost the same script.

1 - Read the CSV file to get the folder for the icons. 2 - Check if the folder exists. 3 - If so, copy the icons from the Numix-Base folder to the hardcoded folder.

For the applications that uses sni-qt like Skype or Megasync we might uses some scripts that already exists to patch those icons.

I will do my best, but i'm not promising anything i will do that in my free time and i will share if i got any news here. And could i use Python instead of Bash script ?

Foggalong commented 9 years ago

That won't work because this isn't a Numix product, so any fix would have to work for all themes. Sorry :(

bilelmoussaoui commented 9 years ago

Well, I thought about something that might be possible. Every theme that have a folder "extras" or "tray_icons" for example will be detected by the script and show a prompt message to the user to choice one of the supported themes? Inside of this folder, the dev must create a folder for every application that he supports; For example Numix theme will support Grive tray icons and my-weather-indicator; capture du 2015-04-08 17 45 34 And the script will match every folder name with the application name (will be in the csv file). and copy the icons from there to the hardcoded folder.

Foggalong commented 9 years ago

That could work! Though it'd require doing a GTK lookup to find what the currently supported theme was, and I don't know how good bash is for that kind of thing.

It might also be worth seeing which themes would get on board with it first, like I did when first setting up the fixer. It's one thing sticking to sensible naming conventions but another to restructure the theme so I think some might be reluctant :/

bilelmoussaoui commented 9 years ago

I don't think that bash is the best choice. So i decided to write the code in Python. I've already done some tests. To avoid problems, i will try to make the naming-conventions as easy as possible.

I didn't really understand what did you mean by doing a GTK lookup?

Foggalong commented 9 years ago

Well imagine the user has Moka & Numix installed., he script has to know which icons to copy into the hardcoded location because it can't copy both :P

As for Python, you'll have to convince me it's a better choice than bash. The script was originally written in Python before we switched to bash, and phantom94 maintained a Python rewrite until we dropped that for just bash too.

bilelmoussaoui commented 9 years ago

Well, when you open the script, the first thing the script checks for the supported themes; and then show up a list with all the supported ones and asks the user to choice one.

Well, i can not really convince you as i've never wrote something using Bash, and Python comes with a lot of functions that will save us time and hard-work.

Foggalong commented 9 years ago

Ah, yeah I guess that could work :)

Because up to now the script has solely been the copying and modifying of files it's proved quicker to use Bash than Python, but this issue could prove otherwise.

andia89 commented 9 years ago

Don't want to be a wiseass here but why not something simpler? First of all the icon theme lookup in python works great using something like (if you want to use gtk)

from gi.repository import Gtk theme = Gtk.IconTheme.get_default()

and why not just look if the icons exists (theme.has_icon(icon_name)) in the current theme, and if yes copy it to the respective folders?

bilelmoussaoui commented 9 years ago

Well, if you want to look to the 22x22 status there's will be hundreds of files.. For example My-Weather-Indicator? Every file must be indexed in the data.csv (the database that will be used in the hardcode fixer). And that will take a lot of time...Only if you've a way to make it more easier.

And that fact of checking for all supported themes. For example, if you use Numix-Circle with Moka base instead of Numix base. And you just check for the used theme, Numix-Circle is not a base theme so you won't have any status icons their.

andia89 commented 9 years ago

Agreed, didn't think about that :) Well than happy programming, if you need any help let me know :)

bilelmoussaoui commented 9 years ago

Thank you, i've already finished my first beta and it's works! :smiley: I just have a problem using git, i created a new repo and i really have no idea how to push the work i've in my local git into the repo i've create. If you can help me about this, i will be very thankful

Foggalong commented 9 years ago

Have you followed GitHubs tutorials for making a new repo? (git init, etc)

bilelmoussaoui commented 9 years ago

Yes ! and i really don't know how this is not working. When i use

git push origin mastar

Nothing happens

Foggalong commented 9 years ago
cd /path/to/repo
git add --all
git commit -m "Your message here"
git push origin master
``
bilelmoussaoui commented 9 years ago

well, i've now this error message

ssh: connect to host gmail.com port 22: Network is unreachable
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Foggalong commented 9 years ago

Well that's weird O.o did you configure git with your credientials?

bilelmoussaoui commented 9 years ago

I've removed everything, recreated an other folder for gitproject..and followed the tuto in the github site. Everything works fine; but when i try to push into my repo i got this now:

git push origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
Foggalong commented 9 years ago

How weird :/

bilelmoussaoui commented 9 years ago

Well, i will share with you what i did maybe i'm missing something. First thing, i created a folder "Hardcode-TrayIcons

cd Hardcode-TrayIcons
git init
git add --all 
git commit -m "First release" 
git push origin master

When i did this, i got nothing so i add a new remote

git remote -v 
git remote add origin ssh://git@github.com/bil-elmoussaoui/Hardcode-Tray.git

And now when i try pushing into my repo i get nothing

git push origin master
bilelmoussaoui commented 9 years ago

And using gitg : capture du 2015-04-08 21 15 35

bilelmoussaoui commented 9 years ago

You can say hello to my first commit in github : https://github.com/bil-elmoussaoui/Hardcode-Tray the supported apps (for the moments) are in data.csv !

Foggalong commented 9 years ago

Awesome! :dancer:

andia89 commented 9 years ago

Fantastic! One small thing though: instead of cp -rf you could use symlinks. This way if the icons change in the supported theme it immediately is reflected for the app :)

bilelmoussaoui commented 9 years ago

I tried using ln -s src dst but it's not working as the files already exists.. so i will keep using cp -rf at the moment until i push a new update. Thank you!

andia89 commented 9 years ago

ln -sf works :)

bilelmoussaoui commented 9 years ago

Well, thanks. i'm still new in the bash script commands ;) For the google chrome icon, how did you manage to open the chrome_100_percent.pak?

Foggalong commented 9 years ago

As a quick note, os.call has been deprecated in favor of from subprocess.call :)

bilelmoussaoui commented 9 years ago

Thanks @Foggalong. i just had a course in Python this year in the university. Still a beginner

Foggalong commented 9 years ago

Closing this because Hardcode-Tray now takes care of this issue :)