dotfiles/.bin/xiate-link-handler

14 lines
418 B
Text
Raw Normal View History

2021-04-17 10:06:15 +00:00
#!/bin/sh
# $1 = "explicit" or "match"
# $2 = URL
# Save all links to a file for debugging (and, yeah, to have a history).
linkhist=/tmp/xiate-link-history-$USER/history
install -dm0700 "$(dirname "$linkhist")"
printf "%s [%s] [%s]\n" "$(date)" "$1" "$2" >>"$linkhist"
printf "%s" "$2" | xclip -selection clipboard
notify-send -u low -t 5000 -a xiate-link-handler "copied link to clipboard" "$(printf "%s" "$2")"