]> git.lyx.org Git - wiki-uploads.git/blob - LyX/MacX11/lyx-remote.sh
Update version in German docs
[wiki-uploads.git] / LyX / MacX11 / lyx-remote.sh
1 #!/bin/sh
2 # lyx-remote - opens files in a running LyX
3 # © 2002 Ronald Florence
4 # ron@18james.com, 16 Dec 2002, 18 May 2003
5
6 [ $# -ne 1 ] && { xmessage -nearmouse "Usage: $0 lyx-file"; exit; }
7 PIPE=`perl -n -e 'print if s/^.serverpipe\s+"(.+)"/$1/;' ~/.lyx/preferences`
8 [ "X$PIPE" = "X" ] && { xmessage -nearmouse "No lyxpipe defined."; exit; }
9
10 running=`ps -uxc | perl -n -e 'print if s/.+\s+(lyx)$/$1/;'`
11 if [ "X$running" = "X" ] 
12   then 
13   rm -f $PIPE.in $PIPE.out
14   cd $HOME
15   PATH=$PATH:/usr/local/bin:/sw/bin
16   DISPLAY=${DISPLAY-localhost:0.0}
17   export PATH DISPLAY
18   lyx $@ &
19 else
20   if [ -e ${PIPE}.in ]
21   then
22     echo "LYXCMD:lyx-remote:file-open:$1" > $PIPE.in
23     read a < $PIPE.out
24     echo $a
25   else
26     xmessage -nearmouse "Hmmm.  LyX is running but there is no server pipe."
27   fi
28 fi