Switch to Wayland with side effect to Clipboard

New to Gambas? Post your questions here. No question is too silly or too simple.
Post Reply
01McAc
Posts: 75
Joined: Sunday 24th January 2021 8:25pm

Switch to Wayland with side effect to Clipboard

Post by 01McAc »

Since I switched from X11 to Wayland the Clipboard command does not work anymore:
Clipboard.Copy(myCam & " +" & str_myLens, "text/plain")

Any idea what's wrong with this?
User avatar
BruceSteers
Posts: 1563
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Switch to Wayland with side effect to Clipboard

Post by BruceSteers »

01McAc wrote: Tuesday 27th December 2022 8:17am Since I switched from X11 to Wayland the Clipboard command does not work anymore:
Clipboard.Copy(myCam & " +" & str_myLens, "text/plain")

Any idea what's wrong with this?
It's Wayland.
Loads of stuff does not work with wayland

I'd switch back to x11 if you want decent "has worked for years" tried and tested functionality.

If you want a restricted/limited/incomplete os , go for wayland.

Could be worth trying to use a different toolkit.
Ie. gb-qt5-wayland might work better than gb-gtk-wayland
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1563
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Switch to Wayland with side effect to Clipboard

Post by BruceSteers »

It sounds like it could be a bug though.
Maybe get on the BugTracker and report it.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1563
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Switch to Wayland with side effect to Clipboard

Post by BruceSteers »

maybe you could install
wl-clipboard command?
If at first you don't succeed , try doing something differently.
BruceS
01McAc
Posts: 75
Joined: Sunday 24th January 2021 8:25pm

Re: Switch to Wayland with side effect to Clipboard

Post by 01McAc »

BruceSteers wrote: Tuesday 27th December 2022 12:20pm maybe you could install
wl-clipboard command?
Thanks Bruce. I installed wl-clipboard to follow up on this but it doesn't help unfortunately. Since you mentioned gb-qt5-wayland I checked its status on my system:

dnf list \*gambas\*wayland\*
Last metadata expiration check: 0:26:49 ago on Wed 28 Dec 2022 10:10:41 CET.
Installed Packages
gambas3-gb-gtk3-wayland.x86_64                                         3.17.3-5.fc38                                          @rawhide
gambas3-gb-qt5-wayland.x86_64                                          3.17.3-5.fc38                                          @rawhide


Both wayland components gtk3 and qt5 are installed. But when I open the Gambas project settings I cannot find any wayland components. Do I have to enable them somewhere?
Screenshot_20221228_104334.jpg
Screenshot_20221228_104334.jpg (84.4 KiB) Viewed 2375 times
User avatar
BruceSteers
Posts: 1563
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Switch to Wayland with side effect to Clipboard

Post by BruceSteers »

I think you just use gb.gtk or gb.qt5 component
the wayland switching part is handled by gambas.

so to use gb-qt5-wayland just use gb.qt5

I tried to help by installing wayland plasma-desktop on my laptop here but it was completely unusable.
i could not get any menus to open via mouse click, (not just gambas, everywhere)
I could not type text in the gambas IDE as the font changes size on editing a line and the cursor gets miss positioned.
It changed my language/keyboard from GB to US!
What a mess !!
Like i say if you can install an x11 version of whatever desktop you are using i'd recommend doing so and removing wayland completely
(like i just did ;) ).

Not only is wayland rubbish but also gambas does not support it very well yet.
You have to understand the GUI system in gambas.
It is full of features/functions that when coded will operate the same for the gtk or qt toolkits.
Then comes wayland and there are many things that cannot be done, or work very differently.
So to get the best from gambas use x11 not wayland.
Wayland is still usable with gambas you will just find many problems with some features/functions not working as expected.
Like moving windows via code, using Clipboard, many other things.
If at first you don't succeed , try doing something differently.
BruceS
01McAc
Posts: 75
Joined: Sunday 24th January 2021 8:25pm

Re: Switch to Wayland with side effect to Clipboard

Post by 01McAc »

Wayland- 'good things come to those who wait'. It seems I still have to wait a while to use Wayland. But to be fair I have to admit that wayland is faster and more responsive than X11. Even the wobbly windows are working perfectly :D . At the moment there are two points that prevent me from using it permanently: the way how it works with Gambas and Zoom doesn't work at all with wayand.
My display manager gdm shows the option to start KDE with X11 or Wayland so the choice is up to me.
User avatar
BruceSteers
Posts: 1563
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Switch to Wayland with side effect to Clipboard

Post by BruceSteers »

01McAc wrote: Wednesday 28th December 2022 9:49am
BruceSteers wrote: Tuesday 27th December 2022 12:20pm maybe you could install
wl-clipboard command?
Thanks Bruce. I installed wl-clipboard to follow up on this but it doesn't help unfortunately. Since you mentioned gb-qt5-wayland I checked its status on my system:
Really?

Can you not do something like this...

If Desktop.Platform = "wayland" Then
  Exec ["wl-copy", "-p", "-t", "text/plain", myCam & " +" & str_myLens]
Else
  Clipboard.Copy(myCam & " +" & str_myLens, "text/plain")
Endif


Note: i used the -p flag to use primary clipboard.
Check out the wl-copy help for other options you may want/need

Code: Select all

wl-copy --help
Usage:
	wl-copy [options] text to copy
	wl-copy [options] < file-to-copy

Copy content to the Wayland clipboard.

Options:
	-o, --paste-once	Only serve one paste request and then exit.
	-f, --foreground	Stay in the foreground instead of forking.
	-c, --clear		Instead of copying anything, clear the clipboard.
	-p, --primary		Use the "primary" clipboard.
	-n, --trim-newline	Do not copy the trailing newline character.
	-t, --type mime/type	Override the inferred MIME type for the content.
	-s, --seat seat-name	Pick the seat to work with.
	-v, --version		Display version info.
	-h, --help		Display this message.
Mandatory arguments to long options are mandatory for short options too.
If at first you don't succeed , try doing something differently.
BruceS
User avatar
BruceSteers
Posts: 1563
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Switch to Wayland with side effect to Clipboard

Post by BruceSteers »

also do any of the clipboard managers run on wayland? like clipman / clipit / diodon / etc
if any of them work you could use their shell commands to add text to the clipboard.

(pretty sure clipman is for wayland)
If at first you don't succeed , try doing something differently.
BruceS
01McAc
Posts: 75
Joined: Sunday 24th January 2021 8:25pm

Re: Switch to Wayland with side effect to Clipboard

Post by 01McAc »

Thanks for the reply. Solved finally!
It is very interesting, that the exec command doesn't work either.
    ...
    Exec ["wl-copy", "-p", "-t", "text/plain", myCam & " +" & str_myLens]
     ...


So I tried instead of Exec the Shell command. I found out the Shell command only works with this options on my desktop.
Shell "wl-copy -t text/plain" & myCam & "  " & myLensString Wait


Thank you again for the help and your patient. Happy new year and a very good start into year 2023.
Post Reply