[FIX] X-tile appindicator icons
In Xubuntu, the AppIndicator menu for X-tile doesn't display the icons for the items properly: it displays a icon with the forbidden sign instead.
In this article I provide a solution to this problem and then I explain what I did to fix it.
Fix
Open a terminal window and run (you'll be prompted for your password and your user must have admin privileges):
wget -q -O- http://goo.gl/BEB6r | tar -xz && cd x-tile-icons && ./install-xdg-icons.sh && cd .. && rm -rf x-tile-icons
As can be seen in the image below the problem is now fixed.
Procedure
In this section I describe what I did for fixing the problem. It isn't necessary to comprehend this section to use the fix. I just wrote it for future reference.
After realizing that I needed to install the icons as resources using xdg-icon-resource
, I proceeded with converting the svg icons that existed in X-tile source to PNG images. This step is necessary because xdg-icon-resource
only accepts png and xpm.
The code below performs the conversion using convert
and mogrify
commands, both from the imagemagick
package. First, convert
is used to convert svg to png, using the option -background transparent
to preserve the transparent background. Then mogrify
resizes the image to 16 pixels wide with maximum quality ("0" means no compression). The menu icons are 22 pixels wide, but I had to use 16 because they wouldn't be centered, otherwise.
# Convert the svg images to png and resize them
for icon in $(ls *.svg); do
icon_png=${icon%svg}png
sudo convert -background transparent $icon $icon_png;
sudo mogrify -quality 0 -resize 16x $icon_png
done
After the conversion I stored the png files in a tar file; imagemagick
isn't pre-installed so it's easier to download and to install the images than installing imagemagick
, convert the images and install them.
Now all that's left is using xdg-icon-resource
for installing the icons. But there's a tiny detail that's of the most importance: the optional icon-name
parameter must be provided to the command. Because of this, this step becomes cumbersome, for there has to be a match between the file name and the icon name. One can access the matching values on the cons.py
file; they're assigned the to the ICONS_FILENAMES
variable. Luckily, my programming skills allowed me to cheat and to programmatically write the commands. What I did was to add a new line after the line that starts iterating the icon file names (on the x-tile python file):
for filename, stock_name in cons.ICONS_FILENAMES:
# added the line below to write the commands for me
print "sudo xdg-icon-resource install --novendor --size 22 " + filename.replace('.svg', '.png').replace('glade/','') + " \"" + stock_name + "\""
When I ran the program It printed the commands and I just copied and pasted them on the shell script used for the fix. And that's it, the most important part was done; all I had to do was finish the shell script that automates the fix as much as possible.
Comments
Post a Comment