x64 Linux (Ubuntu): Failed to open clipboard

Report any Hollywood bugs here
Post Reply
User avatar
fingus
Posts: 271
Joined: Fri Sep 16, 2011 9:53 am

x64 Linux (Ubuntu): Failed to open clipboard

Post by fingus »

When i try to use ClearClipboard() SetClipboard(#CLIPBOARD_TEXT, string$) on x64 Linux (Ubuntu) i got the Error: Failed to open clipboard.

Systemwide Clipboard in Linux is working (Copy and Paste).
User avatar
airsoftsoftwair
Posts: 5856
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: x64 Linux (Ubuntu): Failed to open clipboard

Post by airsoftsoftwair »

Tried your script on Ubuntu 20.04 and it worked correctly. No error. What is your Ubuntu version?
User avatar
root
Posts: 26
Joined: Sun Feb 14, 2010 12:24 pm

Re: x64 Linux (Ubuntu): Failed to open clipboard

Post by root »

Hi!
Is there already a solution?
I have the same problem here, Kernel: Linux 6.18.2-2-cachyos-deckify.
User avatar
airsoftsoftwair
Posts: 5856
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: x64 Linux (Ubuntu): Failed to open clipboard

Post by airsoftsoftwair »

root wrote: Mon Dec 22, 2025 1:17 am Hi!
Is there already a solution?
I have the same problem here, Kernel: Linux 6.18.2-2-cachyos-deckify.
As I said, I'm not able to reproduce the problem here. Can you point me at a Linux distribution that I can use to reproduce the issue? Preferably a distribution that is available as a live image that can be run from a USB stick...
User avatar
root
Posts: 26
Joined: Sun Feb 14, 2010 12:24 pm

Re: x64 Linux (Ubuntu): Failed to open clipboard

Post by root »

Hi Andreas!
I used this distribution https://cachyos.org/download/ (Handheld Edition).
They can load an image there, and the problem can be displayed in this booted distribution.

Today I experimented a bit more.
I compiled the sample code "Clipboard Demo" and it works, no problemeo (wtf?).
However, it always shows that the clipboard is empty.

But if I use a program that is based on Rapagui, there are problems with the clipboard.
Here i compiled my tool deepl for linux. http://nickons.org/pb/deepl

and here some code snipes..

Code: Select all

/* Schiebt den uebersetzten Text in die Zwischenablage */
Function p_copy()
text$ = moai.Get("t_output","text")
If StrLen(text$) > 0
	pos1$, pos2$ = moai.DoMethod("t_output","GetSelection")
	If pos1$ = -1
    		SetClipboard(#CLIPBOARD_TEXT,text$) ; kopiert alles
	Else
		SetClipboard(#CLIPBOARD_TEXT,MidStr(text$,pos1$,pos2$-pos1$)) ; kopiert nur markierten Bereich
	EndIf
EndIf
EndFunction

/* Fuegt die Zwischenablage als Source Text ein */
Function p_paste()
If PeekClipboard() = #CLIPBOARD_TEXT
	moai.DoMethod("t_input","Clear")
	type$, text$ = GetClipboard()
	moai.Set("t_input","text",text$)
	moai.Set("t_input","CursorPos",StrLen(text$))
EndIf
EndFunction

Merry Christmas!!
User avatar
airsoftsoftwair
Posts: 5856
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: x64 Linux (Ubuntu): Failed to open clipboard

Post by airsoftsoftwair »

root wrote: Tue Dec 23, 2025 12:57 pm But if I use a program that is based on Rapagui
Thanks, that's the missing piece in the puzzle here. On Linux the clipboard functionality is tied to X11 displays but these aren't there when using RapaGUI because RapaGUI replaces Hollywood's complete display handler. So we need a new way to reroute all clipboard handling through RapaGUI in order to make this work. I've now added a new interface specifically for this to the Hollywood SDK so the next version of RapaGUI can hopefully support this.

Code: Select all

- New [SDK]: Added support for clipboard adapter plugins; if a plugin has the HWPLUG_CAPS_CLIPBOARDADAPTER
  capability bit set, it can override all of Hollywood's inbuilt clipboard functions and re-implement them
  using custom ones
User avatar
root
Posts: 26
Joined: Sun Feb 14, 2010 12:24 pm

Re: x64 Linux (Ubuntu): Failed to open clipboard

Post by root »

Thanks for the quick reply and a happy new year!
:P
Post Reply