[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: accessing the Linux clipboard...



I'm posting this followup for anyone interested in Xy4/Dosemu on Linux
I seem to have finally gotten Xy4 to copy text to the Linux clipboard. Although I was able to get text from the Linux clipboard into Xy4 using an XPL program that could be assigned to a key, doing the reverse has consistently failed until now.
Dosemu has the commands "unix" and "system" that allow you to run Linux
commands from the DOS prompt; "unix" will run a Linux command in the DOS
window, and "system" runs the command outside Dosemu in Linux.
I used the unix command to transfer text from the Linux, using the Linux
program "xclip" to copy the Linux clipboard into a file, and then
inserting the file at the cursor in Xy4.

BX do/nv unix xclip -o -selection c > /home/pgl/data/xy4/clip/toxyQ2
BX me \xy4\clip\toxyQ2
I've since also added a line, adapted from U2's cr210, to convert Linux's linefeed to Xy4's carriage return/linefeed.
Dosemu would not, however, let me use "unix xclip" with success to copy
a file to the Linux clipboard, even though this is something xclip is
designed to do; the transfer would fail or Xy4 would become unstable.
I recently tried using "system" not to run xclip but to run a one-line
shell script file that runs xclip, and so far this seems to work.
However, I could not get consistently accurate copying from Xy4 using
SAD to save defined text to a file; sometimes I'd lose some text at the
beginning of the highlighting and pick up a corresponding quantity of
text after the end of the highlighting. Copying the text to Xy4's
clipboard and then pasting that text into the file "frxy," which xclip
then copies to the Linux clipboard, seems to avoid that problem.
I ended up with an XPL program that for now looks like this (with line
breaks for clarity); it also converts Xy4's CR/LF to Linux's LF, but it
doesn't remove the EOF:

BX es 1Q2
JM CopyQ2
BX ca \xy4\clip\frxyQ2
«IF«ER»»BX ne \xy4\clip\frxyQ2 «EI»
TF DF BF DF RD UN
TF XP BX ci ³←³◙³Q2
BX st/nv \xy4\clip\frxyQ2
BX do/nv system xytonix.shQ2
GT BX es 0Q2

encoded version:

XPLeNCODE v2.0
b-gin [UNTITLED]
[BX_]es 1[Q2_][JM_]Copy[Q2_][BX_]ca \xy4\clip\frxy[Q2_]{<}IF{
<}ER{>}{>}[BX_]ne \xy4\clip\frxy[Q2_]{<}EI{>}[TF_][DF_][BF_][
DF_][RD_][UN_][TF_][XP_][BX_]ci {252}[cr|lf]{252}{010}{252}[Q
2_][BX_]st/nv \xy4\clip\frxy[Q2_][BX_]do/nv system xytonix.sh
[Q2_][GT_][BX_]es 0[Q2_]
-nd
XPLeNCODE

The xytonix.sh script that xytonix.pm runs consists only of this:

#! /bin/bash
#
# for xywrite/dosemu, for use with xytonix.pm
# copies frxy to clipboard for system use
#
xclip -i -selection c < /home/pgl/data/xy4/clip/frxy
Xytonix.sh is in my ~/data/xy4/clip directory, with a symbolic link to it in my
~/bin directory.
The Linux program "xclip" needs to be installed; it's available in the Ubuntu and, presumably, Debian repositories.
This routine seems to have worked fine over the last couple days. I find
the EOF character is easily removed with the backspace key after
inserting the clipboard contents into a Linux program; since I don't
move that much text from Xy4 to Linux programs, this isn't a big problem
for me.

Paul Lagasse