diff --git a/kmail.sh b/kmail.sh index 4b8a56f..13e5fa8 100755 --- a/kmail.sh +++ b/kmail.sh @@ -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