/Hardcode-Tray

Fixes Hardcoded tray icons in Linux

Primary LanguagePython

Code Issues Codacy Badge Codacy Badge Gitter Hardcode-Tray release

Hardcode-Tray

Fixes Hardcoded tray icons in Linux

The script will automatically detect your default theme, the right icon size, the hard-coded applications, the right icons for each indicator and fix them. All that with the possibility to revert to the original icons.

Themes

Here's a list of themes that supports Hardcode-Tray:

Preview
Preview

Install

Arch Linux (AUR):

Stable version:

yaourt -S hardcode-tray sni-qt-patched-git lib32-sni-qt-patched-git

The sni-qt patched library by Hardcode-Tray team is still on beta, we will replace the git version with a stable release once we release one. Developpement version:

yaourt -S hardcode-tray-git sni-qt-patched-git lib32-sni-qt-patched-git

Ubuntu 14.04 / 16.04 / 16.10 / 17.04 (PPA):

sudo add-apt-repository ppa:andreas-angerer89/sni-qt-patched
sudo apt update
sudo apt install sni-qt sni-qt:i386 hardcode-tray

OpenSUSE (Leap 42.2 / Tumbleweed):

OpenSUSE package only contains the patched version of sni-qt. In order to get Hardcode-Tray, please follow the manual installation method.

The one click-installer can be found by following this link

Manual installation:

  1. Download and install the script:
cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/install.sh | bash
  1. Install dependencies:
  • git
  • wget
  • python3
  • python3-gi
  • patched sni-qt
  • 2.1. Pick your favorite conversion tool
    1. python3-cairosvg
    2. librsvg
    3. inkscape
    4. imagemagick
    5. svgexport

You can build the patched version of sni-qt from source code if you are using another distro (like Fedora).
The sni-qt:i386 is used for 32 bits applications as Skype.
Teamviewer is also using the sni-qt package. However, it is shipping its own version. Therefore this script also overwrites the version shipped by TeamViewer with the patched one. 4. Open Hardcode-Tray using this command

hardcode-tray
  1. Enjoy!

Options

  • --apply and --revert

Hardcode-Tray shows by default a welcome message and asks the user to choose between applying the fix or reverting it. You can hide that using

hardcode-tray --apply

or

hardcode-tray --revert
  • --only

You can use --only argument to fix/revert only one application, don't use the argument if you want to fix all applications your icon theme supports.

hardcode-tray --only telegram, skype

In order to get the names needed to fix only specific programs, you can look at the app_name key in the JSON files for the program. There you can find the corresponding name for the program you want to fix.

  • --path

If you installed your app in a non-standard location, you can override the path where the icons are stored using the --path argument. Only works in combination with the --only argument for a single application.

hardcode-tray --only telegram --path /home/user/telegram/
  • --size

You can also use --size {24,22,16} to force the script to use a different icon size or if the script does not detect your desktop environment.

hardcode-tray --size 24 --only dropbox
  • --theme

You can fix your hardcoded icons using another theme than the default one.

hardcode-tray --theme Numix --only dropbox
  • --light-theme and --dark-theme

Some applications provide dark and light tray icons with the possibility to modify them using their UI. In order to use a dark theme for dark icons and a light one for light icons, you can use those two arguments. It only works if you use both of them at the same time.

hardcode-tray --dark-theme Numix-light --light-theme Numix
  • --conversion-tool

Hardcode-Tray by default detects if the user has either Inkscape, CairoSVG, RSVGConvert, ImageMagick or SVGExport installed and use one of them to convert SVG icons to PNG. In order to choose the tool to use you if one of them is broken in your installation.

hardcode-tray --conversion-tool {Inkscape, CairoSVG, RSVGConvert, ImageMagick, SVGExport}

For now, we support : CairoSVG (python3-cairosvg), Inkscape, rsvgconvert (librsvg), Imagemagick and svgexport(npm library)

Cairo has some issues with converting SVG files that use CSS (see #245).

  • --change-color

Your favorite theme does not provide icons for all those hardcoded icons? Just use an other theme and change the colors using Hardcode-Tray.

hardcode-tray --change-color "#FIRSTCOLOR #REPLACE_FIRST_COLOR" "#SECONDCOLOR #REPLACE_SECOND_COLOR"...
  • --version

You can print the version of Hardcode-Tray using

hardcode-tray --version
  • --update

You can also update to the latest version of the script

hardcode-tray --update
  • --update-git

You can also update to the git version of the script

hardcode-tray --update-git

Config file

Hardcode-Tray also supports a JSON config file that can be placed under ~/.config. The file must be named hardcode-tray.json. The file supports the following options for now.

  • blacklist: a list of applications that you don't want to be fixed.
  • conversion-tool: the default tool to be used everytime you use the script.
  • icons : An object, that contains theme and size for the Gtk icon theme and the icon size to be used.

An example of the config file can be found here. Passing --theme --conversion-tool --size will overwrite the default settings.

Uninstallation

To remove the script completely from your desktop you can use

cd /tmp && wget -O - https://raw.githubusercontent.com/bil-elmoussaoui/Hardcode-Tray/master/uninstall.sh | bash

Credits

  • Modified version of data_pack.py, by The Chromium Authors released under a BSD-style license
  • Qt applications icons name by elementaryPlus team

Hardcode-Tray wiki!