Closed aero31aero closed 8 months ago
I'm assuming this has something to do with how Foliate deals with text, maybe it doesn't use the regular APIs for that and Goldendict cannot detect it?
Assuming it's just using the primary clipboard, which it probably is because AFAIK that's the only API there is for getting the selection, I don't think there's actually a way to prevent the system from getting the selected text from WebKitGTK even if you really wanted to. But just to be sure, you can check this by selecting text in Foliate and pasting the selection, which on most systems you can do by middle-clicking, in another program.
If I have to guess, since popovers are separate windows in GTK 4, and the popover is modal, it might be that the popover is preventing other windows from showing, or something of the sort.
Ah, okay. I see now that you're using the GTK 3 version. Well, in that case perhaps you can try disabling the selection popover in Preferences.
Hey, thanks for the quick reply.
I tried disabling it (When a word is selected > "Do Nothing"), but that didn't help.
But just to be sure, you can check this by selecting text in Foliate and pasting the selection
The text isn't copied to the clipboard automatically. Selecting (When a word is selected > "Copy") does copy it to the clipboard.
You mention I'm running the GTK3 version. Is there a GTK4 version I should try?
Edit: I installed the version from git (GTK4) and still no luck.
No, I don't mean the clipboard. Well, it's a bit confusing because the "clipboard" can refer to many different things.
There are usually two clipboards, or selections used. The first is called "primary", and the other one is called "clipboard". See https://unix.stackexchange.com/questions/139191/whats-the-difference-between-primary-selection-and-clipboard-buffer
Whenever you select any text, it will be available in the primary selection clipboard. To paste this text, you will need to middle click with the mouse or trackpad, rather than clicking "Paste" or pressing Ctrl+V. This is something that's handled automatically by the toolkit and the system.
I guess there a couple things that can be considered here:
Ah, gotcha. I'm on Wayland, Kwin to be specific. Wayland doesn't have the same 3 step primary-secondary-clipboard split. I guess I'm on my own for now.
In that case, I have just the request to be able to run some command like: "myscript.sh ${selection}", but that's more like #791.
I tried all other text that I could select (search input, about the book, add a highlight note), but none show the popup. While typing these, I also realized that FCITX IME doesn't work either (ugh, hate when issues reveal themselves one by one!) so I'd see if there's a pattern too.
Can you leave this issue open in case something changes or someone who knows how Goldendict works internally can chime in?
I'm on Wayland, Kwin to be specific.
Well, that explains it. I had assumed that you were using X11 since Goldendict-ng doesn't seem to support Wayland.
Wayland doesn't have the same 3 step primary-secondary-clipboard split.
I don't know how it works exactly, but there is a primary selection protocol for Wayland now, and on GNOME at least, there is a primary selection. If it doesn't work, it could be a KDE bug or an issue specific to your system.
In that case, I have just the request to be able to run some command like: "myscript.sh ${selection}", but that's more like https://github.com/johnfactotum/foliate/issues/791.
You can achieve that by binding a global shortcut on your desktop to launch dictionary apps with the selected text, e.g.
gnome-dictionary --look-up "$(wl-paste --primary)"
You can also use wl-paste --watch
to look up words whenever the selection changes.
Describe the bug
Foliate's text selection seems to work differently than rest of the system. In Goldendict, there's a feature where when the text selection is updated, it'll show a button to perform a dictionary lookup. That works everywhere on the entire system (Qt apps, GTK apps, electron apps, Discord etc) but not on Foliate. I'm assuming this has something to do with how Foliate deals with text, maybe it doesn't use the regular APIs for that and Goldendict cannot detect it?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Foliate uses whatever standard APIs there are to let the system know that there has been a text selection change. This is fundamentally different from #791, even though the end goal is same.
Screenshots
Version:
Additional context
I know that Foliate itself has dictionary lookup but its pretty useless for languages where words often have multiple forms and you need the word stems, something that goldendict and hunspell are designed to do well. Thus, just using Foliate's dictionary features isn't a good workaround for the core problem.