bilelmoussaoui / hardcode-tray Goto Github PK
View Code? Open in Web Editor NEWFixes Hardcoded tray icons in Linux
License: Other
Fixes Hardcoded tray icons in Linux
License: Other
Just a quick question:
Why do you make the differentiation between light and dark themes? Why don't you just replace both icons (for variety for example variety-indicator
and variety-indicator-light
). For me this seems to be an unnecessary option, the user shouldn't and doesn't care about
One minor thing: You should consider to use 4 spaces instead of tabs for indenting code blocks (this can be automatically done with almost every editor). It makes coding a lot easier and its recommended by the google python styleguide.
https://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Indentation
Nevertheless this is up to you if you don't want to do this, that's fine as well :)
ownCloud not working :( which folder was it you needed a tar of?
For the spotify indicator icon and others i suppose that i will add a new row in the db file; the row will have the script link in the scripts folder (that i will add)
and this python script will call the bash script to fix the icon issue;
for spotify the icons are in
/opt/spotify/spotify-client/Data/locales/resources.zip/_linux/
svg
icons to ico
? yeah spotify uses this.. :/script.py
to handle script filesI think on adding a new column to the database file with the real application name, which will be shown in the messages that are shown to the user, instead of the name we use for the database files.
Also a new line that will be in the first line with
Application Name, Database File, Application Path, Sni Qt Prefix
Which will help contributors in the future if there's any :P
Well, the detect_de is not detecting the right icon sizes in case you're using elementary OS with an other desktop instead of Panatheon.
I think we need a better function to handle all the possible cases
Following on from #92 I thought I'd just run the script and see what happened. Got a bunch of errors in the output:
josh@brain:~/Code/hardcode/main-tray$ ./script.py
(script.py:11401): Gtk-WARNING **: Theme parsing error: gtk.css:2334:31: Missing name of pseudo-class
(script.py:11401): Gtk-WARNING **: Theme parsing error: gtk.css:2337:33: Missing name of pseudo-class
(script.py:11401): Gtk-WARNING **: Theme parsing error: gtk.css:2341:33: Missing name of pseudo-class
You need to have root privileges to run this script.
Please try again, this time using 'sudo'. Exiting.
josh@brain:~/Code/hardcode/main-tray$ sudo -E !!
sudo -E ./script.py
[sudo] password for josh:
(script.py:11405): Gtk-WARNING **: Theme parsing error: gtk.css:2334:31: Missing name of pseudo-class
(script.py:11405): Gtk-WARNING **: Theme parsing error: gtk.css:2337:33: Missing name of pseudo-class
(script.py:11405): Gtk-WARNING **: Theme parsing error: gtk.css:2341:33: Missing name of pseudo-class
Welcome to the tray icons hardcoder fixer!
Your indicator icon size is : 22
Your current icon theme is : elementary-xfce-darker
1 - Install
2 - Reinstall
Please choose: ^CTraceback (most recent call last):
File "./script.py", line 423, in <module>
choice = int(input("Please choose: "))
KeyboardInterrupt
josh@brain:~/Code/hardcode/main-tray$ sudo -E ./script.py
(script.py:11582): Gtk-WARNING **: Theme parsing error: gtk.css:2334:31: Missing name of pseudo-class
(script.py:11582): Gtk-WARNING **: Theme parsing error: gtk.css:2337:33: Missing name of pseudo-class
(script.py:11582): Gtk-WARNING **: Theme parsing error: gtk.css:2341:33: Missing name of pseudo-class
Welcome to the tray icons hardcoder fixer!
Your indicator icon size is : 22
Your current icon theme is : elementary-xfce-darker
1 - Install
2 - Reinstall
Please choose: 1
Installing now..
fixing Chromium failed with error:
Traceback (most recent call last):
File "./data_pack.py", line 135, in <module>
main()
File "./data_pack.py", line 128, in main
dataPack = ReadDataPack(filename)
File "./data_pack.py", line 45, in ReadDataPack
data = ReadFile(input_file, BINARY)
File "./data_pack.py", line 37, in ReadFile
with open(filename, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'chrome_100_percent.pak'
fixing Chromium failed with error:
Traceback (most recent call last):
File "./data_pack.py", line 135, in <module>
main()
File "./data_pack.py", line 128, in main
dataPack = ReadDataPack(filename)
File "./data_pack.py", line 45, in ReadDataPack
data = ReadFile(input_file, BINARY)
File "./data_pack.py", line 37, in ReadFile
with open(filename, mode) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'chrome_100_percent.pak'
mv: cannot stat ‘chrome_100_percent.pak’: No such file or directory
OwnCloud -- fixed using state-ok
OwnCloud -- fixed using state-sync
OwnCloud -- fixed using state-pause
OwnCloud -- fixed using state-error
OwnCloud -- fixed using state-sync
OwnCloud -- fixed using state-information
OwnCloud -- fixed using state-offline
OwnCloud -- fixed using state-ok
OwnCloud -- fixed using state-information
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-connecting-1
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-disturb-notification
fixing Skype failed with error:
Traceback (most recent call last):
File "./database/scripts/qt-tray", line 13, in <module>
fout = open(symlfile, "wb")
OSError: [Errno 40] Too many levels of symbolic links: '/home/josh/.local/share/sni-qt/icons/skype/287ee46e101cabf27ff0509d79bbf636.png'
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-offline
Skype -- fixed using skype-status-connected
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-connected-notification
fixing Skype failed with error:
Traceback (most recent call last):
File "./database/scripts/qt-tray", line 13, in <module>
fout = open(symlfile, "wb")
OSError: [Errno 40] Too many levels of symbolic links: '/home/josh/.local/share/sni-qt/icons/skype/4905a21912d8d5803f345d06ab56e88b.png'
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-away-notification
fixing Skype failed with error:
Traceback (most recent call last):
File "./database/scripts/qt-tray", line 13, in <module>
fout = open(symlfile, "wb")
OSError: [Errno 40] Too many levels of symbolic links: '/home/josh/.local/share/sni-qt/icons/skype/5928f8a678494eb017181ebb00695682.png'
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-away
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-connecting-0
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-invisible
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-disturb
Skype -- fixed using skype-status-offline-notification
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-disturb-notification
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-connecting-2
Skype -- fixed using skype-status-away-notification
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-connected-notification
Skype -- fixed using skype-status-invisible-notification
Skype -- fixed using skype-status-connecting-3
Skype -- fixed using skype-status-disturb-notification
fixing Skype failed with error:
Traceback (most recent call last):
File "./database/scripts/qt-tray", line 13, in <module>
fout = open(symlfile, "wb")
OSError: [Errno 40] Too many levels of symbolic links: '/home/josh/.local/share/sni-qt/icons/skype/fd56304306a9b229dbdaf4cf7dc4cbc7.png'
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Spotify -- fixed using spotify-indicator
Done , Thank you for using the Hardcode-Tray fixer!
We should add a new column in database file for sni-qt application folder; some application uses the same folder as the application names and some don't. For example ,Google play music uses MusicManager
as a folder.
the new db line will look like this :
google-music-manager, /opt/google/musicmanager/google-musicmanager, MusicManager
if the new column is empty nothing will happen, if it's a Qt application we willl take the application name
if you do use the script to fix the tray icons in hangouts, and you reopen the browser the tray icon will disappear and you will need to reinstall the extension; if have this issue with Google chrome beta
any ideas? :/
Wel, still needs to support more apps :
Sni-qt apps? I'm not sure that i will implement anything like this in my code..But who knows
Should we add a license for having some of default chrome icons in the script see here ?
Hello
I did push a new update for dropbox fixes
but there's still something to do:
the dropbox folder name is something like this dropbox-lnx.x86_64-3.6.4
so i did this in the db.csv
file
dropbox,{userhome}/.dropbox-dist/dropbox-lnx{*}/images/hicolor/16x16/status
so i have to remplace the {*}
with the dropbox folder that starts with dropbox-lnx
:P
and i don't have any idea how to do this
Any ideas?
Skype has a lot of repeated icons instead of symlinks. This is due to different version of skype that are supported. I think that having a symlink instead of a copy would be great! i still don't have any idea how to deal with that..
needs either updating (do you manage it?) or switching to this one https://answers.launchpad.net/~cybre/+archive/ubuntu/elementaryplus
Is there any chance we could get workrave to work on this? The apps tray is complicated to say the least involving timer widgets and such but it still has icons which stand out
The db.csv
file isn't valid. Github provides a nice feature for debugging though so it shouldn't be too hard to fix :)
See here: http://askubuntu.com/questions/470691/how-can-i-replace-google-chromes-low-resolution-notification-icon?lq=1 it seems to be pretty complicated to do that
I guess it would be a good idea, to have a way to revert to the default icons (if the user wants to stop using this icon theme). I guess for that a major rewrite is necessary :(
The first one to create an issue:)
Kudos for your work!
However I have a few suggestions that I want to share:
I personally think that your approach with selecting the theme one wants to use is the right thing to do. But I don't think that your approach with an extra
folder is the simplest solution. You really should consider to do something like
from gi.repository import Gtk
theme = Gtk.IconTheme.set_custom_theme(your_chosen_theme)
theme.has_icon(icon_name)
and if True
symlink the icon either from 22x22
or 24x24
to the hardcoded folder. This is actually not slower than your current approach, because list-manipulations are really fast in Python. This would ensure that the icon themes do not need to adapt their structure in order to support your script.
If the icon is present it will be copied if not, fine as well. This means that you'll have initially a little bit more work, because you can't symlink whole folders, but in the long run I think this is a better idea
Another thing: Is the script currently not working? Whenever I try do run it it says The application does not exists, please report this to the dev.
(the problem is telegram
).
Wouldn't it be better to replace the sys.exit
with something that doesn't exit the program return None
or sth similar and not quit the whole program?
Moreover: an improvement would be to have a different error that tells you which program you have to report to the dev :) Sth like The application telegram does not exists yet, please report this to the dev.
If you want I can do this, but I think you understand your program better than I do, so you're rpobably faster
Package names for the patched sni-qt for other distros (Debian, Fedora, Arch, etc) would be useful, or at least a place where it can be compiled from source. Just moved a laptop to Korora and realised I have no idea where the patched version comes from
Hello, I got this qt-tray error:
Traceback (most recent call last):
File "script.py", line 324, in <module>
install()
File "script.py", line 294, in install
p = Popen([script_name, filename, symlink_icon, app_sni_qt_path], stdout=PIPE, stderr=PIPE)
File "/usr/lib/python3.4/subprocess.py", line 848, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.4/subprocess.py", line 1446, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: './database/scripts/qt-tray'
I've tried fixing it by adding another directory and moving script.py and db.csv into it.
It goes through now, but I get:
The application my-weather-indicator does not exist yet, please report this on GitHub
The application skype does not exist yet, please report this on GitHub
No apps to fix! Please report on GitHub if this is not the case
I have both these apps installed. I'm using Elementary OS Freya, with the latest numix circle icons.
ls -R /tmp/sni-qt_*:
/tmp/sni-qt_skype_28585-GVRoum:
icons
/tmp/sni-qt_skype_28585-GVRoum/icons:
hicolor
/tmp/sni-qt_skype_28585-GVRoum/icons/hicolor:
24x24
/tmp/sni-qt_skype_28585-GVRoum/icons/hicolor/24x24:
apps
/tmp/sni-qt_skype_28585-GVRoum/icons/hicolor/24x24/apps:
skype_28585_2d1ee5482260fd9cd180b32787792683.png skype_28585_f2fc4a539a7b9553f5b35241d1154e84.png
skype_28585_37e170fc54e7355d9d298917e74f9ea9.png
cat i use it for telegram in ubuntu unity 14.04?
Here is the error:
Welcome to the tray icons hardcoder fixer!
Copying now..
Traceback (most recent call last):
File "script.py", line 160, in
copy_files()
File "script.py", line 106, in copy_files
apps = csv_to_dic()
File "script.py", line 94, in csv_to_dic
row[1] = dropbox_folder(row[1])
File "script.py", line 79, in dropbox_folder
sub_dirs = get_subdirs(dirs[0])
File "script.py", line 50, in get_subdirs
dirs = os.listdir(d)
FileNotFoundError: [Errno 2] File o directory non esistente: '/home/daniele/.dropbox-dist/'
I solved (just in my case) by removing lines 93 and 94, however i cannot send you a proper patch since a know nothing about python at the moment.
Ok and last but not least the probably biggest issue:
As far as I understand the code right now you need all the telegram icons in order to replace them with icons from the theme (we discussed this also in the numix-base issue tracker). Wouldn't it be a good idea to add a second row in the .txt
files with the icon name that is in the icon theme and is going to replace the original icon? This could be also optional (say if the name is the same, just put , ,
there and the same name is used) and would allow to fix apps like viber
and it wouldn't be necessary to add those funny named symlinks in numix-base
Plus it would be probably a good idea to turn the .txt
files (this is soo Windows :P) to .csv
or at least ommit the extension altogether :)
Everything on the terminal seems to go fine, however the Spotify tray icon is still the original one.
josh@brain:~/Code/hardcode/main-tray$ sudo -E !!
sudo -E ./script.py
[sudo] password for josh:
(script.py:11405): Gtk-WARNING **: Theme parsing error: gtk.css:2334:31: Missing name of pseudo-class
(script.py:11405): Gtk-WARNING **: Theme parsing error: gtk.css:2337:33: Missing name of pseudo-class
(script.py:11405): Gtk-WARNING **: Theme parsing error: gtk.css:2341:33: Missing name of pseudo-class
Welcome to the tray icons hardcoder fixer!
Your indicator icon size is : 22
Your current icon theme is : elementary-xfce-darker
1 - Install
2 - Reinstall
Please choose:
My current theme is Numix :(
When looking at for example the flarget database file it looks something like this:
300c99bb493a7061e9852c73b89a09e4.png, flareget-panel.svg, qt-tray
Since HC-tray fixer is in principle a theme agnostic tool, shouldn't the .svg
be removed from the second column? It is irrelevant because we are splitting it afterwards and throwing it away anyways
Might be because of the new detect environment method
Traceback (most recent call last):
File "./script.py", line 311, in
if detect_de() in ("pantheon", "xfce"):
File "./script.py", line 41, in detect_de
if "pantheon" in [environ.get("DESKTOP_SESSION"), environ.get("XDG_CURRENT_DESKTOP").lower()]:
AttributeError: 'NoneType' object has no attribute 'lower'
Hmm for my-weather-indicator no additional icons are needed, just a second column in my-weather-indicator.txt
pointing to weathter-clear.svg
etc., am I right?
Hello ,
We do extract the resources.zip
too many times and zip it again :/ (10 times)
Any idea how to open the zip file only once, change all the files and then zip it again? 👍
I think that using Wiki will be a great idea
Qt
icon names (if you want to contribute)sni-qt
...
What do you think?
Maybe this would work, it should check for SUDO_USER/SUDO_UID to check if run with sudo or getpwname otherwise.
The script doesn't try to fix skype icons. Doesn't the second column in db.csv needs to be a folder? (I don't have a skype folder in /usr/bin
It would be awesome to have support for ownCloud, a self-hosted file syncing service. Let me know what information you need and I'll add it :)
It would be great to see if the script that was called worked or didn't and give an error message if it doesn't. Right now always a success message is given.
I'll give that a try if you wish
When Skype gets a notification it's reverting to the default icon with the little orange dot rather than the blue status icon that this script switches it to
The viber indicator icons are in
/opt/viber/icons
i don't know which one is used for the viber indicator. But this not working in ubuntu/unity/gnome-shell/pantheon desktop. Should we add this? or it's a won't fix!
if i add this, i will have to symlink viber.svg
and not the others
Telegram, spotify, dropbox are installed
Welcome to the tray icons hardcoder fixer!
Copying now..
Traceback (most recent call last):
File "script.py", line 169, in
copy_files()
File "script.py", line 151, in copy_files
cairosvg.svg2png(bytestring=bytes(svg,'UTF-8'),write_to=fout)
File "/usr/lib/python3/dist-packages/cairosvg/init.py", line 43, in
surface_type.convert(_args, *_kwargs))(_surface_type)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 84, in convert
cls(tree, output, dpi).finish()
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 138, in init
self.draw_root(tree)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 191, in draw_root
self.draw(node)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 344, in draw
self.draw(child)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 344, in draw
self.draw(child)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 344, in draw
self.draw(child)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 344, in draw
self.draw(child)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 344, in draw
self.draw(child)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 344, in draw
self.draw(child)
File "/usr/lib/python3/dist-packages/cairosvg/surface/init.py", line 300, in draw
TAGS[node.tag](self, node)
File "/usr/lib/python3/dist-packages/cairosvg/surface/path.py", line 324, in path
draw_marker(surface, node, "end")
File "/usr/lib/python3/dist-packages/cairosvg/surface/defs.py", line 279, in draw_marker
angle1 = node.tangents.pop(0)
IndexError: pop from empty list
A quick thought that would make this script so much more useful:
What do you think about fixing hardcoded non tray-icons as well?
Calibre (I really really hope that at some point the calibre-dev will change his mind about using system-icons) or jdownloader use hardcoded but standard icons that could be changed using your script.
I'm aware that this would require a lot of work setting up the appropriate databases but codewise everything (or most of it) is already here (maybe with a third selection in the script or sth similar)
Sometimes i feel like there's too much continue statement in the script (10 times) ? Are they really needed or i can remove (some of them) without changing in thing in the way the script works
Well, the script work so fine at the moment. Some of variables need to be renamed; and some of line code/functions need comments
copy_files()
is a really so big function, we need to optimize it if possible -wont fix-node-chrome-pak
license -wont fix-convert2svg
is added in three files. we should call the python script in database/scripts
Hello,
The comments are sometimes not very clear.. My english is not that good and sometimes i wrote a long sentence to explain something that can be done with a shorter one.
Anyone want to modify/correct the comments? :)
Thanks!
I think we should add a screenshot before/after using Hardcode-Tray showing the ugly and non-monochrome icons and how they look like after using the script
We have two more issues here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.