Implemented torsocks link opening
This commit is contained in:
@@ -36,6 +36,7 @@ The following features are already (fully or partially) supported in BFG.
|
|||||||
* In-page text search
|
* In-page text search
|
||||||
* Ini-based customization of the current Ttk theme, content fonts and colors
|
* Ini-based customization of the current Ttk theme, content fonts and colors
|
||||||
* Non-TLS mode for systems without TclTLS support
|
* Non-TLS mode for systems without TclTLS support
|
||||||
|
* Opening links in Torified windows (for the systems with torsocks installed)
|
||||||
|
|
||||||
## Non-supported features
|
## Non-supported features
|
||||||
|
|
||||||
@@ -86,6 +87,7 @@ The following keybindings are currently supported:
|
|||||||
* Shift+d: download the file or page contents under the selected link and open it with your default application
|
* Shift+d: download the file or page contents under the selected link and open it with your default application
|
||||||
* Space / Return (Enter): click on the selected link
|
* Space / Return (Enter): click on the selected link
|
||||||
* Shift + Space / Shift + Return (Enter): open the selected link in a new window
|
* Shift + Space / Shift + Return (Enter): open the selected link in a new window
|
||||||
|
* Control + Shift + Space / Control + Shift + Return (Enter): open the selected link in a new window in Tor
|
||||||
* h / Arrow Left / PgUp: scroll the content up 10 lines
|
* h / Arrow Left / PgUp: scroll the content up 10 lines
|
||||||
* j / Arrow Down: scroll the content down 1 line
|
* j / Arrow Down: scroll the content down 1 line
|
||||||
* k / Arrow Up: scroll the content up 1 line
|
* k / Arrow Up: scroll the content up 1 line
|
||||||
@@ -99,12 +101,16 @@ The following mouse bindings are currently supported:
|
|||||||
|
|
||||||
* Left click: open the link
|
* Left click: open the link
|
||||||
* Shift + Left click or Middle click: open the link in a new window
|
* Shift + Left click or Middle click: open the link in a new window
|
||||||
|
* Shift + Middle click or Control + Shift + Left click: open the link in a new window in Tor
|
||||||
* Right click: download the link contents
|
* Right click: download the link contents
|
||||||
* Shift + Right click: download the link contents and open it with your default application
|
* Shift + Right click: download the link contents and open it with your default application
|
||||||
* Scroll wheel: scroll the page content
|
* Scroll wheel: scroll the page content
|
||||||
* Mouse button 8 ("Back") if present: go back in history
|
* Mouse button 8 ("Back") if present: go back in history
|
||||||
* Mouse button 9 ("Forward") if present: go forward in history
|
* Mouse button 9 ("Forward") if present: go forward in history
|
||||||
|
|
||||||
|
Note: opening a link in Tor requires Tor to be running and torsocks command to be installed in the system.
|
||||||
|
|
||||||
|
You don't need to do any special combinations to open links in Tor once the parent window is already opened via torsocks. You also cannot open new windows in clearnet from the Tor-enabled windows.
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
|
|||||||
@@ -272,7 +272,7 @@ proc clicklink {linknum} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# open link in a new window
|
# open link in a new window
|
||||||
proc windowlink {linknum} {
|
proc windowlink {linknum istor} {
|
||||||
global bfg_prompt sentry_status linklist ilinklist
|
global bfg_prompt sentry_status linklist ilinklist
|
||||||
global tclpath scriptpath
|
global tclpath scriptpath
|
||||||
set url [lindex $linklist $linknum]
|
set url [lindex $linklist $linknum]
|
||||||
@@ -289,7 +289,8 @@ proc windowlink {linknum} {
|
|||||||
unset -nocomplain bfg_prompt
|
unset -nocomplain bfg_prompt
|
||||||
}
|
}
|
||||||
# forward the URL to a new window
|
# 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
|
# link downloading logic
|
||||||
@@ -362,9 +363,10 @@ proc linkinsert {textw prevurl rooturl url name iprefix tag} {
|
|||||||
}
|
}
|
||||||
# handle possible interactive part
|
# handle possible interactive part
|
||||||
set bindcmd "clicklink $linkcount"
|
set bindcmd "clicklink $linkcount"
|
||||||
set bindcmd2 "windowlink $linkcount"
|
set bindcmd2 "windowlink $linkcount 0"
|
||||||
set bindcmd3 "downloadlink $linkcount 0"
|
set bindcmd3 "windowlink $linkcount 1"
|
||||||
set bindcmd4 "downloadlink $linkcount 1"
|
set bindcmd4 "downloadlink $linkcount 0"
|
||||||
|
set bindcmd5 "downloadlink $linkcount 1"
|
||||||
lappend ilinklist $iprefix
|
lappend ilinklist $iprefix
|
||||||
# perform the insertion
|
# perform the insertion
|
||||||
$textw insert end $linktext "$tagname $tag"
|
$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 <Button-1> $bindcmd
|
||||||
$textw tag bind $tagname <Shift-Button-1> $bindcmd2
|
$textw tag bind $tagname <Shift-Button-1> $bindcmd2
|
||||||
$textw tag bind $tagname <Button-2> $bindcmd2
|
$textw tag bind $tagname <Button-2> $bindcmd2
|
||||||
$textw tag bind $tagname <Button-3> $bindcmd3
|
$textw tag bind $tagname <Control-Shift-Button-1> $bindcmd3
|
||||||
$textw tag bind $tagname <Shift-Button-3> $bindcmd4
|
$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 <Enter> "set prev_status \"\$bfg_status\";set bfg_status [trunc \"$url\"];%W configure -cursor hand2"
|
||||||
$textw tag bind $tagname <Leave> {
|
$textw tag bind $tagname <Leave> {
|
||||||
set bfg_status $prev_status
|
set bfg_status $prev_status
|
||||||
@@ -1113,13 +1117,25 @@ bind . <Key> {
|
|||||||
|
|
||||||
bind . <Shift-space> {
|
bind . <Shift-space> {
|
||||||
if {$linkcount > 0} { # we have some links
|
if {$linkcount > 0} { # we have some links
|
||||||
windowlink $curlink
|
windowlink $curlink 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bind . <Shift-Return> {
|
bind . <Shift-Return> {
|
||||||
if {$linkcount > 0} { # we have some links
|
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