An easy wrapper for the urxvt terminal to embed it into Tcl/Tk applications . Works on X but not on Wayland because the latter does not support the Xembed protocol.
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 } }
DDG If you just need one embedded Terminal you can use also the following simple function.
package require Tk proc urxvterm {w} { frame $w -container 1 $w configure -width 100 -height 100 set pid [exec urxvt -rv -embed [scan [winfo id $w] %x] &] bind $w <Destroy> [list exec kill $pid] return $w } pack [urxvterm .term] -side top -fill both -expand yes