From b24c0fad9146b4de7270bdc7a2ec94b39ea576e8 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 1 Oct 2023 02:17:38 -0400 Subject: [PATCH] Try to parse reminders for url, if found and xclip is installed, place the url in the clipboard and notify the reminder without the url. Much nicker for speech. --- scripts/reminder.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/scripts/reminder.sh b/scripts/reminder.sh index b1706d9..579715a 100755 --- a/scripts/reminder.sh +++ b/scripts/reminder.sh @@ -261,7 +261,20 @@ fi if [[ $# -ne 0 ]]; then sox -ndqV0 synth .1 tri 600 norm -9 pad .05 repeat - notify-send "$*" --expire-time=30000 + notification="$*" + if [[ "${notification}" =~ "http" ]]; then + url="${notification##*http}" + url="${url%%[[:space:]]*}" + url="http${url}" + notification="${notification/${url}[[:space:]]/}" + url="${url%[[:space:].?!]}" + fi + if command -v xclip &> /dev/null && [[ "${#url}" -gt 3 ]]; then + echo "${url}" | xclip -selection clipboard + notify-send "${notification} The URL has been copied to the clipboard." --expire-time=30000 + else + notify-send "${*}" --expire-time=30000 + fi exit 0 fi