Version 0 of SnitXUrxvt

Updated 2018-02-03 18:43:08 by DDG

Widget wrapper on Linux Systems for easy embedding of the urxvt Terminal

An easy wrapper for the lightweight surf webbrowser on Linux systems to embed an htmlviewer into Tcl/Tk applications . Requires surf and xprop tools. Works on X but not on Wayland as Wayland does not support the Xembed protocol.

Links

WikiDBImage SnitXUrxvt.png

Source Code:

==========

 package require Tk
 package require snit
 package provide SnitXUrxvt 0.1

 snit::widget SnitXUrxvt {
    option -multi 1,1
    option -rxvtargs ""
    constructor {args} {
        $self configurelist $args
        if {$options(-multi) eq "1,2" || $options(-multi) eq "1,3"} {
            set pw1 [panedwindow $win.pw -orient horizontal]
            set st1 [$self term $win.pw.st1] 
            set pw2 [panedwindow  $win.pw.pw2 -orient vertical]
            set st2 [$self term $win.pw.pw2.st2] 
            set st3 [$self term $win.pw.pw2.st3] 
            if {$options(-multi) eq "1,3"} {
                set st4 [$self term $win.pw.pw2.st4] 
            }
            pack $pw1 -side left -expand yes -fill both

            $pw1 add $st1 $pw2
            if {$options(-multi) eq "1,3"} {
                $pw2 add $st2 $st3 $st4
            } elseif {$options(-multi) eq "1,2"}   {
                $pw2 add $st2 $st3
            }
        } elseif {$options(-multi) eq "1"}  {
            set st1 [$self term $win.st1] 
            pack $st1 -side left -fill both -expand true
        }
    }
    method term {w} {
        frame $w -container 1
        $w configure -width 100 -height 100
        set pid [exec urxvt -rv -embed [scan [winfo id $w] %x] {*}$options(-rxvtargs) &]    
        bind $w <Destroy> [list exec kill $pid]
        return $w
    }
 }

 if {$argv0 eq [info script]} {
    if {[llength $argv] <= 1 } {
        SnitXUrxvt .urxvt -multi 1,3 -rxvtargs "-fade 10 -cr red -sb -rv +bl"
        pack .urxvt -side top -fill both -expand true
    }
 }

========

Discussion