Skip to content

Instantly share code, notes, and snippets.

@belkarx
Last active May 15, 2022 15:24
Show Gist options
  • Save belkarx/299b6d83a85beee2c2559c1b42f96c1d to your computer and use it in GitHub Desktop.
Save belkarx/299b6d83a85beee2c2559c1b42f96c1d to your computer and use it in GitHub Desktop.
Puts all copied URLs in a file
while clipnotify
do
paste=$(parcellite -c)
if [[ -z $(echo $paste | grep -Eoq "(http|https)://[a-zA-Z0-9./?=_-]*") ]]
then
echo -e "$paste\n$(date +%Y-%m-%d/%H:%M)" >> $HOME/notes/clipurls
### Avoids duplicates
#prev=$(tail -n1 $HOME/notes/clipurls)
#if [[ "$paste" != "$prev" ]]; then
# echo -e "$paste\n$(date +%Y-%m-%d/%H:%M)" >> $HOME/notes/clipurls
#fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment