"Piping" keypresses like the "echo <whatever> | process" construction - Xwindows

This is a discussion on "Piping" keypresses like the "echo <whatever> | process" construction - Xwindows ; Hi All, I'm a bit of a newbe when it comes to X-scripting/progging, so if this is just too newbe, I'm sorry I want to start xdvi and tell it to refresh every x-seconds. For non-x-applications I would do something ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: "Piping" keypresses like the "echo <whatever> | process" construction

  1. "Piping" keypresses like the "echo <whatever> | process" construction

    Hi All,

    I'm a bit of a newbe when it comes to X-scripting/progging, so if this is
    just too newbe, I'm sorry

    I want to start xdvi and tell it to refresh every x-seconds. For
    non-x-applications I would do something like:

    while 1
    do
    echo R;
    sleep 10;
    done | application

    but of course xdvi doesn't take its keypresses from the stdin.

    Any help would be great

    Regards,
    Philip



  2. Re: "Piping" keypresses like the "echo <whatever> | process" construction

    Philip Hölzenspies wrote:
    >Hi All,
    >
    >I'm a bit of a newbe when it comes to X-scripting/progging, so if this is
    >just too newbe, I'm sorry
    >
    >I want to start xdvi and tell it to refresh every x-seconds. For
    >non-x-applications I would do something like:
    >
    >while 1
    >do
    > echo R;
    > sleep 10;
    >done | application
    >
    >but of course xdvi doesn't take its keypresses from the stdin.


    xdvi happens to treat the usr1 signal like the R command, so you could
    write your script something like

    xdvi ... && pid=$!
    while true; do sleep 10; kill -sigusr1 $pid; done

    Of course, the intended use of this is in something like an emacs mode
    where one command can save the buffer, compile the dvi file, and kick
    xdiv to display the new version.

    A more general approach would be to use the XTrap extension
    (specifically the xtrapchar command), or if the app is an Xt app you
    could add appropriate translations in a .ad file. But these things
    really have to be judged on a case-by-case basis.


  3. Re: "Piping" keypresses like the "echo <whatever> | process" construction

    Thanks Kip!

    I should have thought of the possibility that xdvi took signals, but it
    simply didn't occur to me

    This does make my life a whole lot easier (I was checking out XTrap, didn't
    quite get it and had moved on to a combination of Xnest and xnee
    (http://www.gnu.org/software/xnee/), but that was really becomming a lot
    more complex than intended).

    Now I get to have my WYSYWIG LaTeX at last

    Philip

    "Kip Rugger" wrote in message
    news:cm6ah1$99$1@rugger.nodomain.ca...
    >
    > xdvi happens to treat the usr1 signal like the R command, so you could
    > write your script something like
    >
    > xdvi ... && pid=$!
    > while true; do sleep 10; kill -sigusr1 $pid; done
    >
    > Of course, the intended use of this is in something like an emacs mode
    > where one command can save the buffer, compile the dvi file, and kick
    > xdiv to display the new version.
    >
    > A more general approach would be to use the XTrap extension
    > (specifically the xtrapchar command), or if the app is an Xt app you
    > could add appropriate translations in a .ad file. But these things
    > really have to be judged on a case-by-case basis.
    >




+ Reply to Thread