Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the possibility to pass {{selected_text}} to commands and URIs #573

Open
Schneegans opened this issue Aug 9, 2024 · 3 comments
Open
Labels
contributions welcome It would be cool if somebody worked on this one feature request New feature or request

Comments

@Schneegans
Copy link
Contributor

Description

I would be cool if the currently selected text was available in commands and URIs.

Affected Desktop Environments

All

Additional Information

On Linux, there is a concept of a primary selection. That's a clipboard which automatically contains the most recently selected text. On Windows we may have to send a Ctrl+C to the active window in order to get the selected text. On macOS? I have no idea 🙂

@Schneegans Schneegans added feature request New feature or request contributions welcome It would be cool if somebody worked on this one labels Aug 9, 2024
@joh6nn
Copy link

joh6nn commented Aug 9, 2024

Apps exist to do something similar to this on both Mac and Windows:

So it's at least possible. I'll do my best to find the relevant APIs and/or gross hacks needed to make this work for each platform

@ognistik
Copy link
Contributor

I have a Kando menu for a lot of text transformations (through an Alfred workflow). Currently, before doing the text processing, it just executes a CMD C to copy whatever text is selected (and at the end it executes a CMD V to replace). Alfred also has a way of grabbing selected text by setting a keyboard shortcut and sending selected text as an argument for another action, but in reality it's just copying the text—in a similar way as copying with CMD C. Since Alfred has a clipboard manager feature I can easily "restore" my original clipboard.

I used to use Popclip a lot a while back, but I often felt bothered by the auto popup function on selected text and would activate it with a Shortcut only. Now, the auto popup function on selected text is—in my opinion—the one feature that would be hard to replicate by Kando and could be desirable for users that like this behavior with Popclip. I imagine something like having a menu popup for selected text... though I am not sure if this is too obtrusive.

For the actual passing of the text selection, I highly suspect that Popclip does what Alfred does, copying the text and immediately restoring the previous clipboard (while saving the copied text in a variable to be processed). There's this "transient clipboard" option that Alfred and also some clipboard managers offer which allows to quickly save stuff on a clipboard without making this available to other apps... so by using this, Popclip could be copying text that doesn't even appear in any clipboard manager or user's clipboard. That's my guess, anyways.

It's been a while that I used Popclip so I don't know about this, but could also be that it auto detects if it's copying from an input text field (editable, which can replace selected text), or from a non editable one... this could possibly be useful in a Kando variable as well.

@KAGEYAM4
Copy link

This is what i am using in Linux wl-paste -p | xargs flatpak run dev.mufeed.Wordbook -l -> It takes whatever text was recently selected ( primary clipboard ) and launches the command flatpak run dev.mufeed.Wordbook -l <selected-text>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions welcome It would be cool if somebody worked on this one feature request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants