Is there a way to force xdvi to open dvi files in the same window everytime?
February 2, 2005 9:50 AM   Subscribe

is there a way to force xdvi to open dvi files in the same window everytime? (Red Hat Enterprise Server, fvwm window manager). man page and google no help...
posted by pissfactory to Computers & Internet (2 answers total)
 
Write a wrapper script that moves the dvi file to some fixed filename and sends a SIGUSR1 to xdvi? Xdvi will then reload that file, and open the new file. Adding stuff like starting xdvi if it's not already running and such is left as an exercise for the student.
posted by fvw at 10:38 AM on February 2, 2005


Response by poster: This works for anyone else who was wondering... (for files named p###)

#!/usr/bin/perl
$TRUE=1;
$FALSE=0;
$debug=$FALSE;
$name=$0;
# print $name,"\n";
if($name =~ /^(.*)\/([^\/]*)$/){
chdir($1);
$copy = "cp ../../$2.dvi /tmp/p.dvi";
} elsif ($TRUE) {
$copy = "cp ../../$name.dvi /tmp/p.dvi";
}
&run_command($copy);
@processes = &run_command("ps -x");
if (! grep( /xdvi .*p\.dvi/, @processes) ) {
# $xdvi = "xdvi -geometry 1182x853 -s 6 /tmp/p.dvi";
# $xdvi = "xdvi -geometry 1275x897 -s 4 /tmp/p.dvi";
$xdvi = "xdvi -geometry 1040x750 -s 3 /tmp/p.dvi";
&run_command($xdvi);
} else {
%kill
}
# *** END OF MAIN PROGRAM ***

#========================================================================

# *** SUBROUTIN(S) ***

sub run_command {
open(COMMAND,"($_[0]) |") || die("$name: Cannot run '$_[0]': $!.\n");
local(@results)=;
close COMMAND;
return @results;
}

posted by pissfactory at 1:11 PM on February 2, 2005


« Older What's your favorite RSS reader?   |   Ebay Favorite Searches Newer »
This thread is closed to new comments.