0
|
1 |
#!/usr/sww/bin/wish -f
|
|
2 |
|
|
3 |
scrollbar .scroll -command ".list yview"
|
|
4 |
listbox .list -yscrollcommand ".scroll set" -relief raised -geometry 20x20
|
|
5 |
pack append . .scroll {right filly} .list {left expand fill}
|
|
6 |
|
|
7 |
if {$argc > 0} {
|
|
8 |
set dir [lindex $argv 0]
|
|
9 |
} else {
|
|
10 |
set dir .
|
|
11 |
}
|
|
12 |
foreach i [exec ls -aF $dir] {
|
|
13 |
.list insert end $i
|
|
14 |
}
|
|
15 |
proc browse {dir file} {
|
|
16 |
if {$dir != "."} {set file $dir/$file}
|
|
17 |
if [file isdirectory $file] {
|
|
18 |
exec browser.tcl $file &
|
|
19 |
} else {
|
|
20 |
if [file isfile $file] {
|
|
21 |
exec mx $file &
|
|
22 |
} else {
|
|
23 |
puts stdout "This is neither dir nor regular file"
|
|
24 |
}
|
|
25 |
}
|
|
26 |
}
|
|
27 |
|
|
28 |
bind .list <Control-c> {destroy .}
|
|
29 |
bind .list <Double-Button-1> {
|
|
30 |
foreach i [selection get] {browse $dir $i}
|
|
31 |
}
|
|
32 |
focus .list
|
|
33 |
|
|
34 |
|
|
35 |
|