Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save thelegendofbrian/bd4703849198f6b59fb68d961fd4d759 to your computer and use it in GitHub Desktop.
Save thelegendofbrian/bd4703849198f6b59fb68d961fd4d759 to your computer and use it in GitHub Desktop.
Install Custom Icon Theme on Ubuntu Budgie 17.04
#!/bin/bash
declare packname=User-Defined
declare -a sizearray=(16 22 24 32 36 48 64 72 96 128 192 256 480 512)
#
## Create folder structure
#
for size in "${sizearray[@]}"
do
for directory in "apps" "places"
do
echo "Creating /usr/share/icons/${packname}/${size}x${size}/${directory}/"
mkdir -p /usr/share/icons/${packname}/${size}x${size}/${directory}/
done
done
mkdir -p /usr/share/icons/${packname}/scalable/actions/
#
## Create index.theme
#
# Add header
cat << EOF | sudo tee /usr/share/icons/${packname}/index.theme
[Icon Theme]
Name=User-Defined
Comment=A user defined icon theme based on Pocillo
Inherits=Pocillo
# KDE Specifics
DisplayDepth=32
LinkOverlay=link
LockOverlay=lockoverlay
ShareOverlay=share
ZipOverlay=zip
DesktopDefault=48
DesktopSizes=16,22,24,32,48,64,96,256
ToolbarDefault=22
ToolbarSizes=16,22,24,32,48
MainToolbarDefault=22
MainToolbarSizes=16,22,24,32,48
SmallDefault=16
SmallSizes=16,22,24,32,48
PanelDefault=32
PanelSizes=16,22,24,32,48,64,96,256
DialogDefault=32
DialogSizes=16,22,24,32,48,64,96,256
# Directory list
EOF
# Add Directory list
echo -n "Directories=" >> /usr/share/icons/${packname}/index.theme
for size in "${sizearray[@]}"
do
for directory in "apps" "places"
do
echo -n "${size}x${size}/${directory}," >> /usr/share/icons/${packname}/index.theme
done
done
echo -n "scalable/actions" >> /usr/share/icons/${packname}/index.theme
# Remove the last comma
# sed -i '$ s/.$//' /usr/share/icons/${packname}/index.theme
# Add directory descriptions
echo "" >> /usr/share/icons/${packname}/index.theme
echo "" >> /usr/share/icons/${packname}/index.theme
for directory in "apps" "places"
do
if [[ ${directory} = "apps" ]]; then
echo "# Applications" >> /usr/share/icons/${packname}/index.theme
elif [[ ${directory} = "places" ]]; then
echo "# Places" >> /usr/share/icons/${packname}/index.theme
fi
echo "" >> /usr/share/icons/${packname}/index.theme
for size in "${sizearray[@]}"
do
echo "[${size}x${size}/${directory}]" >> /usr/share/icons/${packname}/index.theme
if [[ ${directory} = "apps" ]]; then
echo "Context=Applications" >> /usr/share/icons/${packname}/index.theme
elif [[ ${directory} = "places" ]]; then
echo "Context=Places" >> /usr/share/icons/${packname}/index.theme
fi
echo "Size=${size}" >> /usr/share/icons/${packname}/index.theme
echo "Type=Threshold" >> /usr/share/icons/${packname}/index.theme
echo "" >> /usr/share/icons/${packname}/index.theme
done
done
cat <<EOT >> /usr/share/icons/${packname}/index.theme
# Actions
[scalable/actions]
MinSize=1
Size=128
MaxSize=256
Context=Actions
Type=Scalable
EOT
#
## Revert custom icons back to default
#
for size in "${sizearray[@]}"
do
for file in "gimp" "google-chrome" "steam" "transmission"
do
if [[ -f "/usr/share/icons/hicolor/${size}x${size}/apps/${file}.png" ]]; then
echo "Making symbolic link to /usr/share/icons/hicolor/${size}x${size}/apps/${file}.png"
ln -s /usr/share/icons/hicolor/${size}x${size}/apps/${file}.png /usr/share/icons/${packname}/${size}x${size}/apps/${file}.png
fi
done
done
ln -s /usr/share/icons/hicolor/scalable/actions/pane-hide-symbolic.svg /usr/share/icons/${packname}/scalable/actions/pane-hide-symbolic.svg
ln -s /usr/share/icons/hicolor/scalable/actions/pane-show-symbolic.svg /usr/share/icons/${packname}/scalable/actions/pane-show-symbolic.svg
#
## Add new custom icons
#
mkdir /tmp/custom-icon
cd /tmp/custom-icon
# Add the empty trash can icon
wget -O user-trash.png http://icongal.com/gallery/download/83708/16/png
xdg-icon-resource install --noupdate --size 16 --context places --theme ${packname} user-trash.png
wget -O user-trash.png http://icongal.com/gallery/download/83707/22/png
xdg-icon-resource install --noupdate --size 22 --context places --theme ${packname} user-trash.png
wget -O user-trash.png http://icongal.com/gallery/download/83706/24/png
xdg-icon-resource install --noupdate --size 24 --context places --theme ${packname} user-trash.png
wget -O user-trash.png http://icongal.com/gallery/download/83705/32/png
xdg-icon-resource install --noupdate --size 32 --context places --theme ${packname} user-trash.png
wget -O user-trash.png http://icongal.com/gallery/download/83704/48/png
xdg-icon-resource install --noupdate --size 48 --context places --theme ${packname} user-trash.png
wget -O user-trash.png http://icongal.com/gallery/download/83703/72/png
xdg-icon-resource install --noupdate --size 72 --context places --theme ${packname} user-trash.png
wget -O user-trash.png http://icongal.com/gallery/download/83702/128/png
xdg-icon-resource install --noupdate --size 128 --context places --theme ${packname} user-trash.png
# Link the empty trash can for different names
for size in 16 22 24 32 48 72 128
do
for name in "emptytrash" "gnome-fs-trash-empty" "gnome-stock-trash" "trashcan_empty" "xfce-trash_empty"
do
ln -s /usr/share/icons/${packname}/${size}x${size}/places/user-trash.png /usr/share/icons/${packname}/${size}x${size}/places/${name}.png
done
done
# Add the full trash can icon
wget -O user-trash-full.png http://icongal.com/gallery/download/81805/16/png
xdg-icon-resource install --noupdate --size 16 --context places --theme ${packname} user-trash-full.png
wget -O user-trash-full.png http://icongal.com/gallery/download/81804/22/png
xdg-icon-resource install --noupdate --size 22 --context places --theme ${packname} user-trash-full.png
wget -O user-trash-full.png http://icongal.com/gallery/download/81803/24/png
xdg-icon-resource install --noupdate --size 24 --context places --theme ${packname} user-trash-full.png
wget -O user-trash-full.png http://icongal.com/gallery/download/81802/32/png
xdg-icon-resource install --noupdate --size 32 --context places --theme ${packname} user-trash-full.png
wget -O user-trash-full.png http://icongal.com/gallery/download/81801/48/png
xdg-icon-resource install --noupdate --size 48 --context places --theme ${packname} user-trash-full.png
wget -O user-trash-full.png http://icongal.com/gallery/download/81800/72/png
xdg-icon-resource install --noupdate --size 72 --context places --theme ${packname} user-trash-full.png
wget -O user-trash-full.png http://icongal.com/gallery/download/81799/128/png
xdg-icon-resource install --size 128 --context places --theme ${packname} user-trash-full.png
#
## Generate icon cache
#
cd /usr/share/icons/${packname}
gtk-update-icon-cache .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment