Add x-scheme-handler/tel handler with a dedicated menu

This menu allow the user to

- call
- text
- save

The tel number.
This commit is contained in:
Stacy Harper 2021-09-18 11:54:17 +02:00
parent 87d86b7cf0
commit af856d5bfa
No known key found for this signature in database
GPG key ID: EABA44759877E02A
5 changed files with 72 additions and 2 deletions

View file

@ -0,0 +1,6 @@
[Desktop Entry]
Name=Sxmo Phone Menu
Exec=sxmo_phonemenu.sh
Terminal=false
Type=Application
MimeType=x-scheme-handler/tel

View file

@ -0,0 +1,25 @@
{
"defaultHandlersVersion": {
"en-US": 4
},
"mimeTypes": {
"application/pdf": {
"action": 3,
"extensions": [
"pdf"
]
}
},
"schemes": {
"tel": {
"action": 2,
"ask": false,
"handlers": [
{
"name": "sxmo",
"path": "/usr/bin/sxmo_open.sh"
}
]
}
}
}

View file

@ -5,3 +5,4 @@ image/gif=sxmo-sxiv.desktop
audio/x-m4a=sxmo-mpv-music.desktop
audio/mpeg=sxmo-mpv-music.desktop
application/pdf=sxmo-zathura.desktop
x-scheme-handler/tel=sxmo-phone-menu.desktop

View file

@ -5,7 +5,12 @@
newcontact() {
name="$(echo | sxmo_dmenu_with_kb.sh -p "$icon_usr Name")"
number=
number="$1"
if [ -n "$number" ]; then
number="$(valid_number "$number")"
fi
while [ -z "$number" ]; do
number="$(sxmo_contacts.sh --unknown | sxmo_dmenu_with_kb.sh -p "$icon_phl Number")"
number="$(valid_number "$number")"
@ -132,4 +137,10 @@ main() {
done
}
main
if [ -n "$1" ]; then
cmd="$1"
else
cmd=main
fi
"$cmd" "$@"

View file

@ -0,0 +1,27 @@
#!/usr/bin/env sh
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
set -e
number="$(printf "%s" "$1" | sed -e "s/^tel://")"
number="$(sxmo_validnumber.sh "$number")"
result="$(printf "%s Call %s\n%s Text %s\n%s Save %s\n%s Close Menu\n" \
"$icon_phn" "$number" "$icon_msg" "$number" "$icon_sav" "$number" \
"$icon_cls" \
| sxmo_dmenu.sh -p "Action")"
case "$result" in
*Call*)
sxmo_modemdial.sh "$number"
;;
*Text*)
sxmo_textmenu.sh "$number"
;;
*Save*)
sxmo_contactmenu.sh newcontact "$number"
;;
esac