Commit graph

119 commits

Author SHA1 Message Date
Maarten van Gompel
b5e5387121 minor shellcheck fixes after applying latest patches 2021-04-23 19:23:06 +02:00
Stacy Harper
6426a94e46 Add proximity lock toggle on the config menu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-23 19:16:24 +02:00
Stacy Harper
f4ee396394 Rework the incoming call pickup/discard behavior
* The sxmo_modemmonitor.sh will now run a new sxmo_modemcall.sh
dedicated menu to Pickup, Hangup or Mute the call. It will not write
notifications anymore.

* We now can mute the ring with the new pickup menu. With the default
hook, this will stop the ringtone like the missed_call would do.

* The sxmo_modemcall.sh now use a new sxmo_proximitylock.sh which
will lock the screen when putting the phone in front of the ear. This
script should be smart enough to work smoothly with a crust context.

To achieve this, the proximity_lock will only disable the initial
lock (the one who want to go back in crust after some seconds) if the
phone moved a little bit and is not in your pocket. So forgetting the
phone in a table or not earing the ring in your bag will not empty the
battery. You'll find the phone in crust with notifications.

* The sxmo_modemcall.sh do not monitor finished calls anymore. We leave
it with hangup or being killed by sxmo_modemmonitor.sh. This simplify
the call script and prevent double deleting mmcli calls. I had to use
pids and wait commands to fix and issue and make the script killeable
by the monitor.

Plus, only the monitor will now delete calls. The call script should be
precise on what happen using cached files.

* Discarded and hanged up calls are two different behavior with
different script (by default use the same linked ones)

* Fixed a bug where sometime ringing was started twice. I think this is
cause by the new checkforincomingcalls in the connected state change. We
now use a file to test if the call already has been managed.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-23 19:16:08 +02:00
Stacy Harper
a3e4dc0fa4 Make all sxmo menu SSH mode compatible
We then simplify the sxmo_modemtext that was already using SSH related
behaviors.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-10 13:20:19 +02:00
Stacy Harper
91fe7fbeab Fix the unreliable modem numbers prefix issues
Sometime, the modem will give 0611924312 as incoming text or
call number instead of +33611924312 (example in france).

This cause two issues cause of format missmatch:

* Notifications sometime come from "Unknown" when we actually know
the contact
* Text/Dial menu entries are duplicated with "Unknown" persons

We try here to fix boths issues with a simple idea. We will fallback
to a default prefix when it is missing (on phone like numbers,
composed of 10 numbers).

This prefix is an environment variable that cause 0 impact if missing.

* sxmo_contacts.sh will fix the recent numbers prefixes with the default
* sxmo_modemmonitor.sh will also fix the prefix with the default one

This should solve missmatch issues as both will use country code format

I only recommend to always store contacts in the prefixed format in the
contacts.tsv file.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-10 13:20:19 +02:00
Stacy Harper
65270eaea8 Prevent starting multiple modemmonitor on logout/login
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-09 23:22:21 +02:00
Stacy Harper
c6764c2a0d Fix an issue when number was composed by multiple words
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-05 12:39:39 +02:00
Maarten van Gompel
6dc18e22a3 fixed minor shellcheck issues 2021-04-05 12:08:22 +02:00
Stacy Harper
f9b96d2d28 Update modem status state on errors
If modemmonitor crash for some reason, status bar is not updated. The
reason is that statusbar check if modemmonitor is running, which it is
when trying to shutdown itself.

We change the way modemmonitor is detected using a single modem state
file. If the file is not present, then the monitor is considered not
running.

This single file permit to add more state in the future, without adding
any more files.

We also add a sleep 1, look like it is required to have instand status
bar update.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-05 12:04:34 +02:00
Stacy Harper
262418637f Rework of the sxmo_modemtext with benefit
* Draft files are assigned to each number:

Stored here ".local/share/modem/+33666666666/draft.txt"
We automatically edit this single file, making crash or unexpected
edition issue to leave intact saved draft.

* Simplification of some logics

Having a known draft file instead of using a TEXT var simplify lots
of things

* EDITOR is not run in a subshell

Some editors as kakoune got issues with that. Futhermore, it will be
usefull for some other development as making all menu ssh mode
compatible

* Remove modem check

As we now got draft, why do we care if modem is up or down ?

* Display the contact name instead of it number in the conversation

Or use "Unknown Number (+337798676)"

* Unify display message notif adding possibilities to bypass the
main menu

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-04-05 12:00:49 +02:00
Maarten van Gompel
da3dba4bfb minor fixes to satisfy shellcheck 2021-03-31 20:14:53 +02:00
Maarten van Gompel
ae3e1edd9c kill existing dmenu prior to asking SIM PIN 2021-03-31 17:05:42 +02:00
Maarten van Gompel
cdadb27884 implemented simple unlock sim script using dmenu 2021-03-31 11:42:21 +02:00
Maarten van Gompel
c5c8f3d514 Modem monitor now tracks the modem for state changes and shows the state in the status bar 2021-03-31 11:42:21 +02:00
Stacy Harper
dbc3b1ab50 Allow the sendnewtextmenu to be used with a number as arg
This allow the "Reply" appmenu shortcut to open a new compose message
directly.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-03-30 21:14:30 +02:00
Stacy Harper
18361bd681 Revert "Use less as sms pager to allow scrollback"
This reverts commit 3bb3fb6094.

We cannot use this special less argument as it is not busybox less
compatible.

I add busybox aliases to not reproduce the error in the future.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-03-30 19:08:17 +02:00
Stacy Harper
568eac7dd3 Add a dsubmenu to reply/call on SMS windows
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-03-27 23:22:40 +01:00
Stacy Harper
3bb3fb6094 Use less as sms pager to allow scrollback
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-03-27 14:15:21 +01:00
Stacy Harper
cee4917360 Do not truncate stderr file output
Another script would use sxmo_modemsendsms and maybe put its error
somewhere. We should not truncate stderr as it would break those
scripts.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-03-17 22:32:29 +01:00
Stacy Harper
378fe01738 Add a missed call hook
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-03-17 20:57:51 +01:00
Maarten van Gompel
2f62b7c446 Moved checkmark to icons 2021-03-16 22:01:41 +01:00
Maarten van Gompel
f4ba3978c9 Call common script, moved icons to common script, removed unnecessary aliases from common (let's add them only when there are conflicts), made sure plays along with shellcheck 2021-02-01 18:32:32 +01:00
Maarten van Gompel
7669fa341e adding icons to menus 2021-02-01 18:32:32 +01:00
Maarten van Gompel
24905884ee Removed explicit font from most dmenu calls, dmenu font is read from Xresources now and kept as uniform as possible 2021-02-01 18:32:32 +01:00
Maarten van Gompel
c58fa6a1e9 Added an option (extra notification) to discard an incoming call #157 2021-01-30 21:41:08 +01:00
Maarten van Gompel
24f8ed8478 wait for modem for a bit when it is not immediately available yet (e.g. after crust wakeup) 2021-01-30 21:41:08 +01:00
Maarten van Gompel
1608ab1ae4 increased verbosity in various scripts, and do not run xargs kill when argument is empty (cleaner and clearer stderr messages) 2021-01-30 21:41:08 +01:00
Maarten van Gompel
a42f160ed2 make modemmonitor's dbus hooks more robust and prevent being triggered multiple times 2020-12-09 15:46:21 +01:00
Maarten van Gompel
9a4df9fd28 reworking handling finished/missed calls #134 2020-12-09 15:46:21 +01:00
Maarten van Gompel
2a07cab638 implemented lookupcontactname() in call/text handler, removes non posix-compliant substitutions 2020-12-09 15:46:21 +01:00
Maarten van Gompel
4b4bfc851f explicitly delete calls after hangup/termination #134 2020-12-09 15:46:21 +01:00
Maarten van Gompel
06b25c3bc9 Restore audio to original state after finishing a call #133 2020-12-09 15:46:21 +01:00
Maarten van Gompel
4a90d86f56 Sane message when terminating call with unknown number and more verbose output to stderr from modem scripts 2020-12-09 15:46:21 +01:00
Anjandev Momi
e067fd9ad6 Revert "simplify code to get phone number for incoming calls"
This reverts commit b0bb9ac9fc.

This fixes the issue with modemlog having filled with extra mmcli
output
2020-12-05 23:16:59 -05:00
Anjandev Momi
abd931d9ce shellcheck fix: use -n instead of ! -z 2020-12-04 23:20:54 -05:00
Maarten van Gompel
031bb9de21 no need for number validation when cancelling dialer 2020-12-04 22:15:58 +01:00
Anjandev Momi
236ab9a343 Do not display text only numbers as options when dialing or composing new texts
Signed-off-by: Anjandev Momi <anjan@momi.ca>
Signed-off-by: Reed Wade <reedwade@misterbanal.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-12-04 22:07:27 +01:00
Anjandev Momi
741defe781 Fix short phone numbers or phone numbers with text do not appear in scripts
Fixes #106

Signed-off-by: Anjandev Momi <anjan@momi.ca>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-12-04 22:00:29 +01:00
Anjandev Momi
b0bb9ac9fc simplify code to get phone number for incoming calls
This code uses fewer programs and the code now matches the code for
getting phone number of incoming text.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-12-04 22:00:29 +01:00
Maarten van Gompel
17e3b623bf modemmonitortoggle may take an argument "on" or "off" to force toggling to a desired state
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2020-12-01 22:47:00 -05:00
Maarten van Gompel
c915de82d8 Force new process group using setgid -f when starting anything that may possibly kill an entire progress group (kill -9 0) #117
This fixes https://todo.sr.ht/~mil/sxmo-tickets/117 and the crashes when
toggling the modem monitor.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2020-12-01 22:47:00 -05:00
Anjandev Momi
8b87386006 Fixed user log out when selecting "Close Menu" in dialer
See issue:

https://todo.sr.ht/~mil/sxmo-tickets/117
2020-11-29 02:56:17 -05:00
Maarten van Gompel
a90f565c12 minor quote fix to satisfy shellcheck 2020-11-20 18:17:57 +01:00
Maarten van Gompel
7fb7cd70f3 various indentation fixes (spaces to tabs and stripping trailing whitespace) 2020-11-20 18:10:17 +01:00
Miles Alan
96931ce22c Add back saftey hook for incoming calls to delete notifications if none incoming 2020-11-20 17:30:06 +01:00
Miles Alan
f2fc6a406e Missed call rework: Use dbus to check for missed calls & properly delete pickup
Use dbus to monitor for missed calls. Missed calls used to work but had a
regression due to the work to make text/calls used dbus. This adds the proper
dbus hook for missed calls as well and also changes the incoming call
notification to allow for multiple incoming calls (theoretically).

Tested for a single caller and transitioning the pickup notification
into a missed call notification and all is working good.
2020-11-20 17:27:37 +01:00
Anjandev Momi
e11cf9e523 move sxmo data to XDG_DATA_HOME
Breaking change. Make sure you send an email to the mailing list
telling users to move their
$XDG_CONFIG_HOME/{modem,notifications} files/folders to
$XDG_DATA_HOME

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2020-11-08 19:45:39 -05:00
Reed Wade
cd7762d92a The ring hook was blocking the notification writing.
The hook must be run asynchronously. This allow ringtones to be played
using mpv by exemple.

Signed-off-by: Reed Wade <reedwade@misterbanal.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-11-08 14:33:26 +01:00
Reed Wade
6f94bb8159 Add a new pickup hook that trigger on accept incoming calls
Signed-off-by: Reed Wade <reedwade@misterbanal.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-11-08 14:33:26 +01:00
Maarten van Gompel
00846a1608 don't stumble over single quotes when sending SMS texts and replace double quotes with double single quotes to avoid trouble (a bit patchy)
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-11-06 21:42:40 +01:00