Open antrrax opened 2 years ago
Here is a suggestion
To automate the creation of symbolic links I added this function in the file 'render_places.py'
#key: symlink_name
#value: target_file_name
symlink_dict = {'athena': 'folder', 'desktop': 'user-desktop', 'file-manager': 'folder', 'folder_home': 'user-home', 'folder-open': 'folder-drag-accept', 'folder-remote': 'gtk-network', 'gnome-fs-desktop': 'user-desktop', 'gnome-fs-home': 'user-home', 'gtk-directory': 'folder', 'inode-directory': 'folder', 'kfm': 'folder', 'library-music': 'folder-music', 'nautilus-actions-config-tool': 'folder', 'nautilus': 'folder', 'nemo': 'folder', 'network-server': 'network-workgroup', 'org.xfce.gigolo': 'gtk-network', 'org.xfce.panel.directorymenu': 'folder', 'org.xfce.panel.showdesktop': 'user-desktop', 'org.xfce.thunar': 'folder', 'org.xfce.xfdesktop': 'user-desktop', 'redhat-filemanager': 'folder', 'stock_folder': 'folder', 'system-file-manager': 'folder', 'thunar': 'folder', 'Thunar': 'folder', 'xapp-user-favorites': 'user-bookmarks', 'xfce-filemanager': 'folder'}
def create_symlink_places(symbolic_dict, dir):
for k,v in symbolic_dict.items():
symlink_path = os.path.join(dir, f'''{k}.png''').rstrip()
target_path = os.path.join(dir, f'''{v}.png''').rstrip()
if not os.path.islink(symlink_path):
subprocess.call(['ln', '-s', '-r', target_path, symlink_path])
print(f'''symlink: {symlink_path} created''')
the complete file looked like this:
import os
import subprocess
import sys
colors = ["Yellow-New", "Aqua", "Blue", "Brown", "Green", "Grey", "Orange", "Pink", "Purple", "Red", "Sand", "Teal", "Yellow"]
sizes = ["16", "22", "24", "32", "48", "64", "96", "128"]
#key: symlink_name
#value: target_file_name
symlink_dict = {'athena': 'folder', 'desktop': 'user-desktop', 'file-manager': 'folder', 'folder_home': 'user-home', 'folder-open': 'folder-drag-accept', 'folder-remote': 'gtk-network', 'gnome-fs-desktop': 'user-desktop', 'gnome-fs-home': 'user-home', 'gtk-directory': 'folder', 'inode-directory': 'folder', 'kfm': 'folder', 'library-music': 'folder-music', 'nautilus-actions-config-tool': 'folder', 'nautilus': 'folder', 'nemo': 'folder', 'network-server': 'network-workgroup', 'org.xfce.gigolo': 'gtk-network', 'org.xfce.panel.directorymenu': 'folder', 'org.xfce.panel.showdesktop': 'user-desktop', 'org.xfce.thunar': 'folder', 'org.xfce.xfdesktop': 'user-desktop', 'redhat-filemanager': 'folder', 'stock_folder': 'folder', 'system-file-manager': 'folder', 'thunar': 'folder', 'Thunar': 'folder', 'xapp-user-favorites': 'user-bookmarks', 'xfce-filemanager': 'folder'}
def create_symlink_places(symbolic_dict, dir):
for k,v in symbolic_dict.items():
symlink_path = os.path.join(dir, f'''{k}.png''').rstrip()
target_path = os.path.join(dir, f'''{v}.png''').rstrip()
if not os.path.islink(symlink_path):
subprocess.call(['ln', '-s', '-r', target_path, symlink_path])
print(f'''symlink: {symlink_path} created''')
def generate_color(color):
source = "places/" + color.lower() + ".svg"
if color == "Green":
theme_dir = "../usr/share/icons/Mint-Y"
else:
theme_dir = "../usr/share/icons/Mint-Y-%s" % color
os.system("mkdir -p %s" % theme_dir)
for size in sizes:
icon_dir = os.path.join(theme_dir, "places", size)
icon_dir_2x = os.path.join(theme_dir, "places", size + "@2x")
os.system("mkdir -p %s" % icon_dir)
os.system("mkdir -p %s" % icon_dir_2x)
names = subprocess.check_output("inkscape -S %s | grep -E \"_%s\" | sed 's/\,.*$//'" % (source, size), shell=True).decode("UTF-8")
for name in names.split("\n"):
if "_" in name:
icon_name = name.replace("_%s" % size, "")
icon_path = os.path.join(icon_dir, icon_name + ".png")
print("Rendering %s" % icon_path)
os.system("inkscape --export-id=%s \
--export-id-only \
--export-png=%s %s >/dev/null \
&& optipng -o7 --quiet %s" % (name, icon_path, source, icon_path))
icon_path = os.path.join(icon_dir_2x, icon_name + ".png")
print("Rendering %s" % icon_path)
os.system("inkscape --export-id=%s \
--export-id-only \
--export-dpi=192 \
--export-png=%s %s >/dev/null \
&& optipng -o7 --quiet %s" % (name, icon_path, source, icon_path))
create_symlink_places(symlink_dict, icon_dir)
create_symlink_places(symlink_dict, icon_dir_2x)
def parse_arg(arg):
if arg == "All":
for color in colors:
generate_color(color)
else:
generate_color(arg)
def usage():
print ("Usage: render_places.py color \n\
color can be: Aqua, Blue, Brown, Green, Grey, Orange, Pink, Purple, Red, Sand, Teal, Yellow, Yellow-New or All.")
sys.exit(1)
if len(sys.argv) != 2:
usage()
else:
parse_arg(sys.argv[1])
In Mint-Y Icons Script to automate the creation of symbolic links from the 'places' directory is missing. Also missing script to automate the creation of the index.theme file from the 'places' directory
If I use the script below to try to create a new icon color, the files mentioned in the icon theme are missing, and the icon theme is broken: