diff --git a/scripts/core/sxmo_contactmenu.sh b/scripts/core/sxmo_contactmenu.sh index 5646db7..1c68875 100755 --- a/scripts/core/sxmo_contactmenu.sh +++ b/scripts/core/sxmo_contactmenu.sh @@ -18,7 +18,7 @@ newcontact() { name="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_usr Name")" number= while [ -z "$number" ]; do - number="$(echo | sxmo_dmenu_with_kb.sh -c -l 2 -p "$icon_phl Number")" + number="$(sxmo_contacts.sh --unknown | sxmo_dmenu_with_kb.sh -c -l 10 -p "$icon_phl Number")" number="$(valid_number "$number")" done @@ -49,14 +49,14 @@ editcontactnumber() { oldnumber="$(echo "$1" | cut -d" " -f1)" oldname="$(echo "$1" | cut -d" " -f2)" - ENTRIES="$(printf %b "Old number: $oldnumber")" + ENTRIES="$(sxmo_contacts.sh --unknown | xargs -0 printf "%b (Old number)\n%b" "$oldnumber")" PICKED= # already used var name while [ -z "$PICKED" ]; do PICKED="$( echo "$ENTRIES" | - sxmo_dmenu_with_kb.sh -c -l 3 -p "$icon_edt Edit Contact" + sxmo_dmenu_with_kb.sh -c -l 10 -p "$icon_edt Edit Contact" )" - if echo "$PICKED" | grep -q "^Old number: "; then + if echo "$PICKED" | grep -q "(Old number)$"; then editcontact "$1" return fi diff --git a/scripts/core/sxmo_contacts.sh b/scripts/core/sxmo_contacts.sh index 886dc22..b01cdf1 100755 --- a/scripts/core/sxmo_contacts.sh +++ b/scripts/core/sxmo_contacts.sh @@ -40,8 +40,17 @@ all_contacts() { }' "$CONTACTSFILE" | sort -f -k 2 } +unknown_contacts() { + contacts \ + | grep "Unknown Number$" \ + | cut -d: -f1 \ + | grep "^+[0-9]\{9,14\}$" +} + if [ "$1" = "--all" ]; then all_contacts +elif [ "$1" = "--unknown" ]; then + unknown_contacts else contacts fi