Sublime Forum

Restoring the good old (curved) icon

#1

Since both developers and high-reputation forum members have failed to provide a complete solution for restoring the good old icon of Sublime Text 3, here is a handy script that will do the job.

Copy-Paste this script into an .sh file and start it with sudo.

#!/bin/bash

# Create and change to temp directory created
extract=`mktemp -d`
cd "$extract"

# Get Sublime version 2 (it has the old icon set)
wget -c https://download.sublimetext.com/Sublime%20Text%202.0.2%20x64.tar.bz2 -O sublime.tar.bz2

# Extract the icon folder
tar jxvf sublime.tar.bz2 "Sublime Text 2/Icon"

# Change to the extracted directory
cd "Sublime Text 2/Icon"

# Copy all icon files into their proper system folders
for size in *x*; do
    cp -v "$size/sublime_text.png" "/usr/share/icons/hicolor/$size/sublime-text.png"
    cp -v "$size/sublime_text.png" "/opt/sublime_text/Icon/$size/sublime-text.png"
done

# Clean up
rm -rf "$extract"

You can run this script on each sublime upgrade to get the old icon back.

0 Likes

#2

Just a note of warning: I haven’t gone through this whole script, but it is executing rm -rf "$extract" as root (via sudo), so if there is an error you could significantly damage your system.

0 Likes

#3

…which means you shouldn’t have posted your FUD based on highlighting a part independently from the whole to suggest that my script is dangerous.

There is only one corner case in which it would damage your system. It occurs when mktemp returns an existing system folder which would not happen, only if mktemp is already damaged. Then the system is already damaged, so I don’t see your point.

Assume that there is an error and mktemp fails to create a temp directory. What would happen?

$ extract=`mktemp -d`
mktemp: failed to create directory via template ‘/tmp/tmp.XXXXXXXXXX’: Permission denied
$ rm -rfv $extract
$

As you can see nothing happens, rm was called with an empty parameter, so did nothing.

Of course we can go further by assuming that the user has overwritten mktemp to a magic of his own and it returns a fixed directory. Then that directory would be removed. Nevertheless, we can also assume that he modified cp or wget which should not be run as root either. But let’s just assume that someone who fucks up his system this much does read first what kind of script he executes. This script is not for ignorant copy-paste idiots, but for intelligent and aware users.

0 Likes