I am working on a dictionary project where I need to copy the selected word/text in any application's active window (e.g. a web browser) to the clipboard and then paste the clipboard contents to a JavaFX textfield.
This answer explains how to do this in Windows. The code uses the user32
library and HWND
property to detect the active window in the Windows OS, but in Linux, this example doesn't work.
Are similar libraries, and an example of using them, available in Linux?