Skip to content

How to contribute

Peter J. Mello edited this page Mar 12, 2020 · 1 revision

Easiest way:

1. Report an issue

You see an unthemed icon in your tray? Just open an issue report and let us know which app causes problems

If you're comfortable with Python/JSON or just prefer to do-it-yourself:

1. Create the application database file

The database file has the format of a JSON file. The contents of bitcoin.json below provide a good example:

{
    // The application name
    "name": "Bitcoin", 
    // list of the paths to be checked in order to verify if the application is
    // installed
    "app_path": [ 
        "/usr/bin/bitcoin-qt"
    ],
    // the paths were the icons should be store
    "icons_path": [ 
        "{userhome}/.local/share/sni-qt/icons/bitcoin-qt/"
    ],
    // key to verify if it's a qt application (uses sni-qt to draw tray icons)
    "is_qt": true, 
    // if the application uses a script like electron, zip, binary, nwjs or pak
    "is_script": false, 
    // if the icons folder should be created automatically
    "force_create_folder": true, 
    // if there's a script to be executed in order to get the right icons path,
    // see dropbox.json
    "exec_path_script": false, 
    // if the backup of those icons should be ignored or not
    "backup_ignore": true, 
    "icons": {
        "indicator": {
          // original icon name
            "original": "a7645681bdc53a4f4e8080546ccbb93d.png", 
            // theme icon name
            "theme": "bitcoin-indicator" 
        }
    }
}
  • Normal hard-coded applications For these types of applications, the file has to contain two columns. The icon name in the hard coded path, and the symbolic icon name. The symbolic icon name does not need to have the extension. Example: available_19.png, hangouts-available

    • What should I add to the database file? Each icon has a name like x-w-icon_name.png the x is the same as in the folder name, the w changes whenever the application restarts and the icon_name is the icon that you should add in $HOME/.local/share/icons/x/icon_name.png. You can only use png icons. See the bitcoin.json file for a working example.
  • Electron applications Electron-based applications often store their data on app.asar file that can be found on the installation path of the application. .asar are like Zip files, created to store modules, images and whatever an application might need in order to work correctly on all the platforms.

    • To extract the file, you will need to install asar with the command sudo npm -g install asar
    • Next, extract the archive file (more information can be found here) with asar extract app.asar
    • Once the file is extracted, the first step is to look for the tray icons used by the application by default. Once you've found the icon names, the next step will be getting the icons key from the header file. For that, you will need to get the header information from the asar file. To do so, all you have to do is using this python script:
      import struct
      import json
      from functools import reduce
      
      filename = "app.asar"
      
      asarfile = open(filename, 'rb')
      asarfile.seek(4)
      
      len1 = struct.unpack('I', asarfile.read(4))[0]
      len2 = struct.unpack('I', asarfile.read(4))[0]
      len3 = struct.unpack('I', asarfile.read(4))[0]
      header_size = len3
      zeros_padding = (len2-4-len3)
      
      header = asarfile.read(header_size).decode('utf-8')
      
      files = json.loads(header)
      with open("header.json", 'w') as fp:
          json.dump(files, fp, sort_keys=True, indent=4)
      The hardest part is to read the JSON file and find out the keys of each icon. See stremio.json example
  • Special applications Some applications like Spotify, Google Chrome or Chromium have icons hard coded in a zip folder or a binary file. You can fix those icons by creating a script that will handle the pack, copy, unpack part. You can take a look at Spotify script to have an idea how that works. For example : spotify.json

2. Create a Pull Request