Pages

Showing posts with label icons. Show all posts
Showing posts with label icons. Show all posts

2014-08-10

Icon cache refresh

Sometimes I play with icons - change them or create new ones. And most excitedly, the folder they are in gets broken/unknown icon pics into it after that.
That means - icon-cache needs to be refreshed. Many distros have a script for that which runs on startup. Or something similar - on one way or another, depends on distro and desktop environment.
But if not, one needs to update cache manually.
Basic and primitive way to do this is gtk-update-icon-cache command. That same app is used also by a lot of nice frontends. The command, in terminal, looks like that, in foolproof way:
gtk-update-icon-cache -f -t /path to your icondir - dir where index.theme is
'-f' means force overwrite old cache despite of it state, '-t' means don't worry if there is no index.theme  file.
Dandy. Yeah, but quite frequently not so - and what you get is:
gtk-update-icon-cache: The generated cache was invalid.
You also see that miscreated file starts with '.' - and it's useless as cache.
I happened to have exactly that sad outcome when trying to refresh my icon-theme cache. After exceptionally frustrating googling, I found that - in my case:
- Only thing that mattered (of multiple web-hints), was spaces in icon names. Not existence of icon-size folders, or of index.theme... or something else...
That means, of course, only that I didn't have other possible problems ... if there are more.

Anyway, I got my very big collected icon-theme validated after I removed all spaces from filenames, and nothing else (well, I also checked if my index.theme was correct. It was).

The script below (Thanks to Michael, stackoverflow) looks also to subdirs so, in idea you can run it from /icons or ~/.icons and get every spacy filename switched.
I did it in slow way - as I wanted to know where problems were. I created test-folder and copy/pasted iconfolders to there one by one, and tried to make cache again. Of course, it's easier to change the script to have 'echo' to show which files were changed... in case you are fluent in bash. I'm not, I am outright moron in it. So I did it mechanically, and found that 3 of 12 folders had 'space-problems'.
And here is the script that fixed it:

#! /bin/sh
# Script what finds spaces in filenames and replaces them with _
# to get gtk-update-icon-cache to validate.

# Change this folder according to needs
cd /home/homeros/.icons/test/mimetypes

find . -depth -name '* *' \
| while IFS= read -r f ; \
do mv -i "$f" "$(dirname "$f")/$(basename "$f"|tr ' ' _)" ; \
done
That was that.

2013-02-26

Themes, icons and Xfce


With every (user-friendly) distro comes some DE and some theme and icon-set. It doesn't have to be specially created or DEs' default – it might be some existing theme, tweaked, and hopefully full icon-set added to it.
Xubuntu, for example, has 'elementary xfce' icon-set – which is 'elementary' set tweaked for Xfce.
You can get themes etc in three ways:
1. Download & install as a package from repository – like 'xfwm4-themes' or 'xfce-artwork' and so on. In this case you get bunch of something, installed to root. Available for every user. But it also means – to hack them is a bit hassle.
2. Download them from xfce-look.org, Ubuntu-Art or some other (trusted) site. In this case you have to install them yourself (read install-hints).
a) To root – if you have more users in your Linux, and you want eyecandy to be available to others too. Generally, every theme-folder have to be copied to /usr/share/themes/ and icon-folders to /usr/share/icons/. Then they should automagically appear in Settings Managers.
b) To /home/your_user_name/.themes/ and to /home/ your_user_name/.icons/ - if you are only user or do not want to share, or want to tweak the stuff.
Not everything is compatible! Read notes (usually added) by author.
For example, when using Xfce and LightDM, it's silly to get themes for GDM (Gnome Display Manager). Both GTK 2 and 3 are OK. Metacity (Gnome) is not so OK, because Xfce has xfwm4 as a Window Manager. Sooner or later you happen to download something which doesn't fit and looks odd and broken.
3. You can create your own artwork. More about that later.

Themes use engines to run, that is, certain theme-families share the same engine, or theme may have several in use. Engines have to be installed for theme to work (theme-packages have engines included, separately downloaded ones – not always). When your Appearance Manager whines (hopefully it does - as opposed to simply displaying broken crap), use Synaptic and install the missing part. Just for a fun of naming some engine names: murrine, unico, pixbuf, nodova, aurora, equinox. There are more.

Xfce Window Manager uses specific xpm format, files sit in /xfwm4 folder (in themes' folder). Those files are used to build frame of every window. The process to create those files is not difficult, but it certainly takes time. Complete tutorial is here in xfce wiki. Not-Xfce themes doesn't have this xfce-specific part, unsurprasingly.
Settings Manager (xfce4-settings), includes appearance settings.
Xfce accepts both GTK 2 and GTK 3 style themes – gtk scripts create environment inside of every window. This is a bit more complicated – and I am not competent enough to give tweaking advice here. But, there are tutorials available in web, of course.
Gtk parts of theme live in gtk-2.0 and gtk-3.0 folders.
If you are adventurous and want to build your own theme, then a must is an app called thewidgetfactory (command is twf – it doesn't appear into menu, you have to create launcher yourself). Twf shows you how your buttons, sliders, check-boxes etc etc appear to look at current moment of scripting (or png-making). Gimp helps with png-s (tutorial page).
Gtk script is pure txt - use your text editor (in Xfce, Leafpad), or if you want to feel a bit more sophisticated and pro-looking: Geany or Bluefish might fit.

Icons are not part of theme, strictly speaking. Even more – they are not commonly added into theme-packs. Have to get them separately, then.
Icons are either png (standard format), or svg (scalable vector graphics, a format simply widely used) - for tweaking/creating those, use Inkscape. Icons' conf is described in index.theme file which sits in every icon-sets' folder. Icons are either fixed or scalable. There are hundreds of them, thematically grouped. Very common is to make symbolic links when the same icon is used in several places.
Changing those icons … can drive one almost insane, and it's marvelous to have more than 10 windows open at once... very business-like.
And here are some standards to muse over - when drinking evenings' Earl Grey and nibbling bisquits: Icon theme and Icon naming.

Looking back to past action ends here.