Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

xclip - how to use without a graphics display for testing on Github workflows

54 views
Skip to first unread message

Tom Browder

unread,
Sep 9, 2023, 7:40:06 PM9/9/23
to
We have a Raku module that uses "xclip" during use on a computer with a monitor.  We need to test it with Github workflows which does not have a graphics device. 

Is there any "xclip" option to allow for testing without a graphics devivce without throwing an error? Or any suggestion for a work around?

Thanks.

-Tom

Greg Wooledge

unread,
Sep 9, 2023, 7:50:07 PM9/9/23
to
On Sat, Sep 09, 2023 at 06:36:56PM -0500, Tom Browder wrote:
> Is there any "xclip" option to allow for testing without a graphics devivce
> without throwing an error? Or any suggestion for a work around?

Look at the xvfb package. It gives an X server that exists entirely in
memory, not needing a physical graphics chipset to run against. You
can set DISPLAY to point to the xvfb server, and run X client programs
in that environment.

Tom Browder

unread,
Sep 9, 2023, 8:50:05 PM9/9/23
to
On Sat, Sep 9, 2023 at 18:47 Greg Wooledge <gr...@wooledge.org> wrote:
On Sat, Sep 09, 2023 at 06:36:56PM -0500, Tom Browder wrote:
> Is there any "xclip" option to allow for testing without a graphics devivce

Thanks, Greg!

-Tom

Max Nikulin

unread,
Sep 9, 2023, 10:10:07 PM9/9/23
to
You can create a mock-up and use it instead of real xclip binary.

Tom Browder

unread,
Sep 10, 2023, 5:50:07 AM9/10/23
to
Sounds interesting, Max, can you show the code?

Thanks.

Cheers!

-Tom

Max Nikulin

unread,
Sep 10, 2023, 12:50:06 PM9/10/23
to
On 10/09/2023 16:44, Tom Browder wrote:
> On Sat, Sep 9, 2023 at 21:06 Max Nikulin wrote:
>
>> You can create a mock-up and use it instead of real xclip binary.
>
> Sounds interesting, Max, can you show the code?

Unless you need to test subtle issues like

https://github.com/astrand/xclip/issues/20
"Not closing stdout when setting clipboard from stdin"

faced by e.g. tmux users, something simple should be enough:

#!/bin/sh -eu
: "${XCLIP_MOCK_FILE:=$HOME/.xclip-mock}"

while [ $# -gt 0 ]; do
case "$1" in
-i|-in)
;;
-o|--out) exec cat -- "$XCLIP_MOCK_FILE"
;;
-selection|-target) shift
;;
*) # FIXME xclip treats all unknown options at any position as files
break
;;
esac
shift
done
exec cat -- "$@" >"$XCLIP_MOCK_FILE"

Tom Browder

unread,
Sep 11, 2023, 6:30:07 AM9/11/23
to
Thank, Max! I'll pass it on to the guy who needs it. He slings Wolfram language code for a living.

Best regards,

-Tom
0 new messages