-
Notifications
You must be signed in to change notification settings - Fork 12
/
get_icons
executable file
·117 lines (110 loc) · 2.33 KB
/
get_icons
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/sh
#\
exec jimsh "$0" "$@"
set size 16x16
set theme [expr {([lindex $argv 0] ne "") ? [lindex $argv 0] : "tango"}]
set themes {
gnome2 {
paths {
~/.icons/OldGNOME2/16x16/*/*
}
}
late-afternoon {
paths {
~/.icons/LateAfternoon/*/small/*
~/.icons/LateAfternoon/*/big/*
}
}
faenza {
paths {
~/.icons/Faenza/*/16/*
}
}
faience {
paths {
~/.icons/Faience/*/16/*
}
}
baku {
paths {
~/.icons/Baku/16x16/*/*
~/.icons/Baku/scalable/*/*
}
map {
user-trash stock_delete
}
}
tango {
paths {
~/.icons/tango/16x16/*/*
~/.icons/tango/scalable/*/*
/usr/share/icons/Tango/16x16/*/*
}
map {
utilities-terminal system-run
user-trash stock_delete
view-refresh document-revert
}
}
}
proc collect {} {
global theme themes env index
set i 0
set paths [concat [dict get $themes $theme paths] \
[dict get $themes tango paths]]
set map {}
catch {set map [dict get $themes $theme map]}
foreach p $paths {
switch -glob -- $p {
#* {continue}
~/* {set p [regsub {^~} $p $env(HOME)]}
}
foreach f [glob -nocomplain $p] {
set key [regsub {\.[^.]*$} [file tail $f] {}]
if {[dict exists $map $key]} {
set index($i/[dict get $map $key]) $f
} else {
set index($i/$key) $f
}
}
incr i
}
set index(n) $i
}
proc find_icon {name} {
global index
for {set i 0} {$i < $index(n)} {incr i} {
set key $i/$name
if {[info exists index($key)]} {
return $index($key)
}
}
}
proc from_svg {from to} {
global size
exec convert -background none $from -resize $size $to
}
proc get {from to} {
set src [find_icon $from]
puts "; $from <- $src"
switch -glob -- $src {
*.png {file copy -force $src $to}
*.svg {from_svg $src $to}
default {puts stderr "Cannot find $from"}
}
}
collect
get document web/document.png
get down web/download.png
get folder web/folder.png
get folder-new web/folder_new.png
get folder-open web/folder_open.png
get html web/html.png
get view-fullscreen web/maximize.png
get document web/new.png
get document-revert web/revert.png
get stock_delete web/rm.png
get system-run web/run.png
get document-save web/save.png
get text-x-generic web/shen_source.png
get up web/upload.png