-
Notifications
You must be signed in to change notification settings - Fork 91
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 oneshot mode to sync clipboard #27
Comments
Can you show me Your solution doesn't make much sense. It doesn't sound like you want a function, it sounds like you want a oneshot mode. |
https://github.com/kaihendry/clipmenu/blob/url-shortcut/clipmenu-url Yes, oneshot "request the clipboard manager to take over the ownership of the clipboard" as put on http://askubuntu.com/a/61328/676 |
Sounds reasonable enough. |
@kaihendry do I understand correctly that you are trying to launch your browser from the selected text? You're trying to take a very roundabout approach to this. The better way is to use a more direct approach with
Replace your clipmenu-url with this single line of code :) |
This is a very good suggestion, thank you! The only drawback is that I may want to use the script on the last URL after making another non-URL selection, if that makes sense? |
Sure. To accomplish that, I would combine your approach and mine. Something like #!/bin/bash
LC_COLLATE=C
if url=$(xsel -co > /tmp/sel && grep --only-matching --perl-regexp "http(s?):\/\/[^ \"\(\)\<\>\]]*" "/tmp/sel")
then
xdg-open $url
else
files=(/tmp/clipmenu/*)
for (( i=${#files[@]}-1; i>=0; i-- )); do
file=${files[$i]}
if url=$(grep --only-matching --perl-regexp "http(s?):\/\/[^ \"\(\)\<\>\]]*" "$file")
then
xdg-open $url
break
fi
done
fi I have not tested this, you might have to make some adjustments. |
Weird, |
For the past week or so, clipmenud has not worked for me, and actively prevents me from copying anything. I've been meaning to make an issue but haven't found the time to dig into what caused this. Does |
Reverted to using
|
This is a prerequisite for adding oneshot mode, see #27.
Easy enough now that we have locking support, see db05c51 :-) |
When I copy from my terminal, I've noticed that sometimes the default sleep of 0.5 is not quick enough to synchronize, leaving my
clipmenu-url
to act on the wrong URL for example.Clipmenud's loop needs to be refactored into a function so I can call clipmenu from st directly.
The text was updated successfully, but these errors were encountered: