-
Notifications
You must be signed in to change notification settings - Fork 54
/
import-from-other-theme
executable file
·49 lines (40 loc) · 1.84 KB
/
import-from-other-theme
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/python3
import os, sys
if __name__ == '__main__':
if len(sys.argv) == 4:
basedir = os.getcwd()
(prgname, icontype, iconname, foreignpath) = sys.argv
if not os.path.exists(foreignpath):
print("%s not found." % foreignpath)
sys.exit()
sizes = ["16", "22", "24", "32", "48", "64", "96", "256"]
types = ["apps", "actions", "places"]
if icontype not in types:
print ("Unknown icon type: %s" % icontype)
sys.exit()
local_theme = "usr/share/icons/Mint-Y"
if not os.path.exists(local_theme):
print ("%s not found." % local_theme)
sys.exit()
for size in sizes:
for scale in ["", "@2x"]:
print("")
possible_paths = ["{type}/{size}{scale}", "{size}{scale}/{type}", "{type}/{size}x{size}{scale}", "{size}x{size}{scale}/{type}"]
for possible_path in possible_paths:
possible_path = possible_path.format(type=icontype, size=size, scale=scale)
path = os.path.join(foreignpath, possible_path, iconname)
if os.path.exists(path):
local_path = "%s/%s/%s%s/%s" % (local_theme, icontype, size, scale, iconname)
print ("cp %s %s" % (path, local_path))
os.system ("cp %s %s" % (path, local_path))
print("")
else:
print ("")
print("Usage: %s icon-type icon-name foreign-path" % sys.argv[0])
print("")
print ("Note: icon-type is the type of icon")
print ("Note: icon-name is the filename of the icon")
print ("Note: foreign-path is the path to the theme to import from")
print ("")
print ("Example: %s apps brasero.png /usr/share/icons/Moka" % sys.argv[0])
print ("")