1. Home
  2. Linux

How To Use Hardcode Tray To Change System Tray Icons In Linux

System tray icons are useful, but they can clash with themes that you have installed. There’s also the fact that there is no single design standard to follow when designing a system tray icon. If you’re trying to make it so that every program icon matches in the system tray, there’s a better option than replacing images manually, one by one. Introducing Hardcode Tray: it’s a terminal based Linux app that can scan programs with built-in tray icons and replace them to match the system’s icon theme. This tool works incredibly well, and is a great resource for those that like to have absolute control over the way their Linux PC looks.

Hardcode-Tray  On Ubuntu

Hardcode Tray is very easy to install on Ubuntu, as there is a PPA readily available. To install it, first open up a terminal window. Run an update, to make sure you have all of the latest software fixes, and updates:

sudo apt update

sudo apt upgrade -y

After the update is complete, it’s safe to add the new software source to the system.

sudo add-apt-repository ppa:andreas-angerer89/sni-qt-patched

Even though the new repository is on the system, Ubuntu can’t see it. To fix this, update the system’s software sources:

sudo apt update

With the sources up to date, all that is left is to install the software. .

sudo apt install sni-qt sni-qt:i386 hardcode-tray

Hardcode-Tray  On Arch Linux

Hardcode Tray is readily available for Arch Linux users via the AUR. To install it, first download the latest snapshot of the program. Most of the dependencies should automatically install as you try to build the package. If ones fail, refer to the download page and look through the dependencies needed. You may need to download and build these snapshots as well.

Extract the downloaded archive via terminal with:

tar xf hardcode-tray.tar.gz

Then, use the CD command to enter the newly extracted folder.

cd hardcode-tray

Start the build process with the makepkg command. Please note that the compilation isn’t instant, so depending on your hardware it may take a couple seconds.

makepkg

After the build finishes, install it to the system using pacman.

sudo pacman -U *.pkg.tar.xz

Hardcode-Tray  On OpenSUSE

The Hardcode Tray tool is available (unofficially) for Open SUSE 42.3, via the Arc and Papirus software repository. Please understand that installing this software through this method isn’t foolproof, and it may not work.

sudo zypper ar -p 98 http://download.opensuse.org/repositories/home:/GNorth:/Arc_and_Papirus/openSUSE_Leap_42.3/home:GNorth:Arc_and_Papirus.repo

sudo zypper ref 

sudo zypper in Hardcode-Tray

Even after installing Hardcode Tray to Suse it may not work with this method. As a result you may need to skip the Suse instructions in favor of building Hardcode Tray manually. This is because the repository is unofficial, and mostly untested. The developer warns of this being a possibility.

Hardcode-Tray  On Generic Linux Builds

To build this software from, you need to first install the various dependencies required for it to build properly. As each Linux distribution has a different name for each of these packages, the best course of action is to go to the development page, find the names of the libraries and tools needed that way. Then, open up a terminal and start the building process:

git clone https://github.com/bil-elmoussaoui/Hardcode-Tray
meson builddir --prefix=/usr

After using meson to specify the prefix and build directory, use the Ninja tool to install everything to the system.

sudo ninja -C builddir install

Using Hardcode Tray

To use Hardcode tray, you’ll first need to install and use an icon theme for Linux that supports the software. As of right now, there are only two options: the Papirus icon theme, and the Numix icon theme. Each of these themes have great support for Hardcode Tray.

When your Linux PC has an icon theme that has support for Hardcode Tray, the software can work. To use it, open up a terminal window and enter the following command into the shell.

Note: It is important to use the -E switch, as it will preserve the environment that the program runs in, rather than simply running as a root command.

sudo -E hardcode-tray

From here, the tool offers 3 options to choose from. These options are “apply”, “revert” and “clear backup cache”. To apply the changes to any of the status icons on your Linux PC choose “1”. After that, select the icon theme that the program should use as a basis to replace the default icons.

Please keep in mind that Hardcode Tray only replaces icons in the system tray if it detects the programs on your Linux PC. For best results, launch a program at least once prior to attempting to change the icon in the tray.

Changing Back

If you decide you don’t like the replacement system tray icon, Hardcode Tray offers up an easy way to revert back. To undo the change, open up a terminal window and run:

sudo -E hardcode-tray

When the selection menu appears, choose the “Revert” option instead of the “apply” option. Then, just choose the backup you’d like to revert to.

Leave a comment