Send mail address to X11

This commit is contained in:
Jeremy Gardais 2020-03-18 15:26:12 +01:00
parent 373316fddb
commit 481349d07e
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
1 changed files with 8 additions and 2 deletions

View File

@ -33,14 +33,20 @@ case "$#" in
exit 1
;;
* )
contact_pattern="$*"
debug_message " Verify arguments: Script get ${#} arguments."
contact_pattern="${*}"
;;
esac
# ]]]
debug_message "Look for a contact with these informations:\n${contact_pattern}"
contact_line=$(khard email "${contact_pattern}" | sed -n 2p)
debug_message "Matching contact:\n${contact_line}"
contact_mail=$(printf '%s' "${contact_line}" | awk '{print $NF}')
debug_message "Mail of this contact:\n${contact_mail}"
# Print the message to X11
printf '%s' "${contact_mail}" | xdotool type --clearmodifiers --file -
exit 0