0

I've been trying (for a few days) to find out if it's possible to implement placing a popover near where the user is typing, which works as a daemon and is able to detect the position of the caret in any third-party GTK3 app.

I've got the impression that it's possible to get the current active window in GDK, and then get the currently active GTK widget (from which I would hope to get coordinates somehow).

Is this possibile at all? I've also experimenting with other methods to figure out the position where the user is typing (x/y position of the caret), but they all have some problems.

Any idea?

nkkollaw
  • 1,947
  • 1
  • 19
  • 29
  • That's not possible. The impression that you can get widgets from other apps is not correct. The best way to do this would be with a loadable GTK module, not a daemon. – ptomato Nov 24 '18 at 16:44
  • (As modules are going away in GTK 4 and the GTK team is trying to figure out what sorts of extension points would be needed to replace them, it would be good if you could elaborate about your use case on gtk-devel-list once you have got it working with a GTK module.) – ptomato Nov 24 '18 at 16:45
  • Got it. I'll look into what GTK modules are. This is what I want to do: https://stackoverflow.com/questions/53346707/get-x-y-position-of-caret-input-text-cursor-under-xorg/. It doesn't seem possible in a clean way... :-/ – nkkollaw Nov 25 '18 at 18:01
  • ...so, a GTK module gets loaded by all GTK apps and would be able to get to the current widget in any app? Do you know if Chrome (for Electron apps) uses GTK as well, on Linux? – nkkollaw Nov 25 '18 at 18:14
  • It does, but it uses GTK 2.x which would require a different module – ptomato Nov 25 '18 at 18:48
  • Ah, awesome. If you followed the link to what I'm trying to achieve, would you achieve with this method? I'm trying different ways, the rationale behind this one is that I can probably figure out X/Y position if I have the GTK module being edited. – nkkollaw Nov 25 '18 at 19:13

0 Answers0