Converting Android icon packs to icon themes
Downloading the icon pack
To use icons in Linux system one has to obtain them either bundled in .apk installation package or as separate images. Possible sources are:
- Application stores (Note that some application store clients - such as the official application of Google Play Store - do not save .apk files in storage to be accessed by user. In this case it is recommended to use other stores or third-party clients/frontends);
- Forums (e.g. XDA);
- Icon pack's repository.
Getting the icons
First of all, it is needed to find the directory which contains the icons. To do that, one has to check the list of files in the apk file first. It can be done with either an archiver application (e.g. xarchiver) or via command line.
$ unzip -Z -1 iconpack.apk | less
-Z means zipinfo mode and
-1 sets the verbosity level.
Icons are most likely to be stored at one of
res/drawable* folders or in
If there are multiple folders with icons, extract the icons with needed dpi. Here is the list of folders from highest to lowest dpi:
|Directory||Approximate dpi||Icon size|
If not there, icons may be located at
res/drawable-nodpi*/ which is for density-independent resources.
When the folder was found, one can do something like
$ unzip -j icon_pack.apk "res/drawable-nodpi-v4/*" -d "icon_theme_dir"
This command extracts all files from
res/drawable-nodpi-v4/ to directory named
icon_theme_dir. If this directory doesn't exist, it is created.
Creating a theme
Icon themes can be located in
/usr/share/icons/ and consist of
index.theme file, which describes the theme, and directories with icons.
index.theme contents are as follows:
[Icon Theme] Name=Icon Theme Name Comment=Detailed icon theme description goes here Directories=48x48/apps,scalable/apps [scalable/apps] Size=48 Type=Scalable MinSize=1 MaxSize=256 Context=Applications [48x48/apps] Size=48 Type=Fixed Context=Applications
Directories key accepts the list of subdirectories separated by commas as value. There must be a section for every listed subdirectory. The subdirectories are checked from left to right. So, in this example, an icon from 48x48/apps is used if 48x48 icon is needed. If the size differs, a scalable icon is used instead.
Refer to the latest icon theme specification for example and detailed documentation.
To pick a proper filename for an icon, one should check the .desktop file of the related program in one of the directories
Example: for this desktop file
[Desktop Entry] Name=random.txt Exec=gedit /home/user/random.txt Icon=gedit
icon name must be
gedit.xpm. It is possible to use symlinks to reuse the same icon for multiple programs.