Popclip like application for Linux / KDE?

All, is there a compareable application available for Linux like PopClip for Mac (https://www.popclip.app/) ?

PopClip is a Mac utility tool that pops up with a menu of actions when you select text on your screen giving you instant access to useful actions. For me this one of the most used app on my Macs for many years now. With its open plugin architecture for extensions it enables you to run every kind of action related to the selected text.
Or if there is nothing compareable, can one give me some kind of starting point to write the application? I understand that the X11 system does not make it easy to access the text selection in every kind of window. Is that easier with wayland / KDE instead of X11?

My first attempts were not successful, the approch was like … any idea?

    Display *dpy;
    Window owner;
    Atom sel;
    char *selections[] = { "PRIMARY", "SECONDARY", "CLIPBOARD", "FOOBAR" };
    size_t i;

    dpy = XOpenDisplay(NULL);
    if (!dpy)
    {
        fprintf(stderr, "Could not open X display\n");
        return 1;
    }

    for (i = 0; i < sizeof selections / sizeof selections[0]; i++)
    {
        sel = XInternAtom(dpy, selections[i], False);
        owner = XGetSelectionOwner(dpy, sel);
        printf("Owner of '%s': 0x%lX\n", selections[i], owner);
    }

I am not quite sure, but if you look through the settings of KDE’s Klipper tool you will find settings which sound like they might facilitate automatic showing of an action list. The Klipper functionality has quite bad UX though, so I didn’t dig deep enough to figure out if this might be able to serve a similar purpose as PopClip.

1 Like