Implemented torsocks link opening
This commit is contained in:
@@ -272,7 +272,7 @@ proc clicklink {linknum} {
|
||||
}
|
||||
|
||||
# open link in a new window
|
||||
proc windowlink {linknum} {
|
||||
proc windowlink {linknum istor} {
|
||||
global bfg_prompt sentry_status linklist ilinklist
|
||||
global tclpath scriptpath
|
||||
set url [lindex $linklist $linknum]
|
||||
@@ -289,7 +289,8 @@ proc windowlink {linknum} {
|
||||
unset -nocomplain bfg_prompt
|
||||
}
|
||||
# forward the URL to a new window
|
||||
exec -ignorestderr -- $tclpath $scriptpath $url &
|
||||
if {$istor eq 1} {set epath "torsocks $tclpath"} else {set epath $tclpath}
|
||||
exec -ignorestderr -- {*}$epath $scriptpath $url &
|
||||
}
|
||||
|
||||
# link downloading logic
|
||||
@@ -362,9 +363,10 @@ proc linkinsert {textw prevurl rooturl url name iprefix tag} {
|
||||
}
|
||||
# handle possible interactive part
|
||||
set bindcmd "clicklink $linkcount"
|
||||
set bindcmd2 "windowlink $linkcount"
|
||||
set bindcmd3 "downloadlink $linkcount 0"
|
||||
set bindcmd4 "downloadlink $linkcount 1"
|
||||
set bindcmd2 "windowlink $linkcount 0"
|
||||
set bindcmd3 "windowlink $linkcount 1"
|
||||
set bindcmd4 "downloadlink $linkcount 0"
|
||||
set bindcmd5 "downloadlink $linkcount 1"
|
||||
lappend ilinklist $iprefix
|
||||
# perform the insertion
|
||||
$textw insert end $linktext "$tagname $tag"
|
||||
@@ -372,8 +374,10 @@ proc linkinsert {textw prevurl rooturl url name iprefix tag} {
|
||||
$textw tag bind $tagname <Button-1> $bindcmd
|
||||
$textw tag bind $tagname <Shift-Button-1> $bindcmd2
|
||||
$textw tag bind $tagname <Button-2> $bindcmd2
|
||||
$textw tag bind $tagname <Button-3> $bindcmd3
|
||||
$textw tag bind $tagname <Shift-Button-3> $bindcmd4
|
||||
$textw tag bind $tagname <Control-Shift-Button-1> $bindcmd3
|
||||
$textw tag bind $tagname <Shift-Button-2> $bindcmd3
|
||||
$textw tag bind $tagname <Button-3> $bindcmd4
|
||||
$textw tag bind $tagname <Shift-Button-3> $bindcmd5
|
||||
$textw tag bind $tagname <Enter> "set prev_status \"\$bfg_status\";set bfg_status [trunc \"$url\"];%W configure -cursor hand2"
|
||||
$textw tag bind $tagname <Leave> {
|
||||
set bfg_status $prev_status
|
||||
@@ -1113,13 +1117,25 @@ bind . <Key> {
|
||||
|
||||
bind . <Shift-space> {
|
||||
if {$linkcount > 0} { # we have some links
|
||||
windowlink $curlink
|
||||
windowlink $curlink 0
|
||||
}
|
||||
}
|
||||
|
||||
bind . <Shift-Return> {
|
||||
if {$linkcount > 0} { # we have some links
|
||||
windowlink $curlink
|
||||
windowlink $curlink 0
|
||||
}
|
||||
}
|
||||
|
||||
bind . <Control-Shift-space> {
|
||||
if {$linkcount > 0} { # we have some links
|
||||
windowlink $curlink 1
|
||||
}
|
||||
}
|
||||
|
||||
bind . <Control-Shift-Return> {
|
||||
if {$linkcount > 0} { # we have some links
|
||||
windowlink $curlink 1
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user