-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-version-2.0.sh
73 lines (40 loc) · 1.13 KB
/
main-version-2.0.sh
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
#!/usr/bin/wish
set fp [open config]
set itemList [exec cat config]
set i 0
wm attribute . -topmost 1
labelframe .software -text "Software" -width 130 -height 300 -padx 1m -pady 1m
labelframe .service -text "Service" -width 130 -height 300 -padx 1m -pady 1m
pack .software .service
# 预处理配置文件内容e c
foreach item $itemList {
puts $item
set name [exec echo $item | cut -d ":" -f 2]
set kind [exec echo $item | cut -d ":" -f 3]
switch $kind {
1 {
set pathName .software.b$i
}
2 {
set pathName .service.b$i
}
}
button $pathName -text $name -textvariable $item -width 13
bind $pathName <1> {
set item [%W cget -textvariable]
set cmd [exec echo $item | cut -d ":" -f 1]
set kind [exec echo $item | cut -d ":" -f 3]
switch $kind {
1 {
exec {*}$cmd &
}
2 {
set cmd [string trimleft $cmd]
clipboard clear
clipboard append $cmd
}
}
}
pack $pathName
incr i
}