Commit graph

149 commits

Author SHA1 Message Date
Stacy Harper
390a59c318 Fix sxmo_modemcall recent regressions
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-26 21:41:54 +02:00
Maarten van Gompel
1ca8672473 minor syntax fix, quote var 2021-08-25 23:35:35 +02:00
Stacy Harper
829f8241c7
Add Arch handlers to manager daemons in sxmo_modemmonitortoggle 2021-08-25 21:51:02 +02:00
Stacy Harper
af733083c0
Make sxmo_modemmonitortoggle reset ospotent 2021-08-25 19:29:11 +02:00
Peter John Hartman (wart)
a8693545a4
Dialer menu should be with keyboard (so you can enter number).
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-25 19:29:10 +02:00
Maarten van Gompel
a9ac024fe9 use --index instead of -idx for compatibility with bemenu, requires similar patch for dmenu 2021-08-24 23:11:58 +02:00
Maarten van Gompel
088fd0b593 fixed typo in dmenu option 2021-08-24 22:29:00 +02:00
Stacy Harper
62e5dd146b
Fix the dmenu autoclosing on ended call.
Oops.
2021-08-23 18:29:12 +02:00
Stacy Harper
8a27933c47 SWMO - SXMO over Wayland
This is a huge patch for Swmo, Sxmo over Sway.

It is Dwm backward compatible so dwm users should not expect regressions.

If you install all dependencies, you then can toggle between Sway and Dwm using a new config entry. It will reboot the phone.

This commit also contains:
    * Make the modemmonitor bullet proof
    * various other smaller fixes

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-22 13:23:22 +02:00
Maarten van Gompel
994f4dc1e1 increase retry interval a bit so modem doesn't reset too soon 2021-07-29 23:45:36 +02:00
Stacy Harper
61a138a153 Fix remaining issue with states cause of dangling event files
We also have to remove them on outgoing call. We use find instead of rm
with a wildcard cause wildcard look not expanded here.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-07-29 21:54:06 +02:00
Stacy Harper
d4fd25e3e9 Prevent some error states cause of dangling event files
Some event file stay present in some case (ex: .initiated) and this can
lead to issues in futures calls.

We remove dedicated cleanup and now we remove all event file related to
the finish call in once. We do it in incoming call cause sometime
modemnager fail to detect terminated calls.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-07-25 18:23:49 +02:00
Maarten van Gompel
edc48a01d2
ModemMonitor: Periodically check whether the modem is still alive, reset it if not
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-07-25 17:28:54 +02:00
Maarten van Gompel
8cf2d3d561
unlocksim fix
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-07-20 14:37:38 +02:00
Anjandev Momi
1f563dd873 fix dtmf tones with busybox grep: dont set initial value
busybox grep doesnt have -b flag

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-07-11 22:08:51 +02:00
Stacy Harper
3d9fc07157 Prevent the incomingcallmenu to go futher if the menu failed
This can happen if an call come while a menu already is open of if the
user kill the dmenu with a top side gesture.

We dont want the notification to be purged to allow the user to manually
open it with the notification appmenu so we have to stop the code here.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-07-07 15:01:54 -04:00
Stacy Harper
4c0b70442c Close the dial when the contact hang up on initiated calls
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-07-07 14:51:24 -04:00
Stacy Harper
e6ea657634 Cleanup hooks
This add a script to use either the user hook or the default one.

Sometime we checked the user hook or a default code. We move this
default code in a defaut hook.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-29 22:43:16 +02:00
Stacy Harper
02a37c9dea Add back a notification when receiving a call
If a menu already is open while receiving a call, the dedicated menu
could not open itself. It prevent completly the user to pickup the call.

We add a notification to open this menu manually.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-29 22:42:32 +02:00
Stacy Harper
60dd08fa27 Fix sxmo_modemtext in terminal mode
As we rely on the terminal name to use the contextual menu, we used the
st target directly, preventing to use the taillog command in terminal
mode.

Add an optional TERMNAME env variable to manage this smoothly.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-21 22:59:55 +02:00
Stacy Harper
e428d0c4a4 Simplify the termmode detection
As we now rely on sxmo_terminal.sh and the TERMCMD env variable, we then
can simplify things.

In the sxmo dwm context, TERMCMD="st -e" so sxmo_terminal.sh will run
the command in st.

In the ssh context, we dont have TERMCMD so sxmo_terminal.sh will just
run the command

In a tmux context, we can set TERMCMD="tmux split-window" with
set-environment -g TERMCMD "tmux split-window"
so sxmo_terminal.sh will run the command in a splited window.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-21 22:59:20 +02:00
Stacy Harper
7cf1dadf5f Fix the notification for outgoing call hanged up by the contact
There was a hole in the event logging where we start a call that the
contact hang up. As we dont have an event for outgoing call,
modemmonitor think this is a missed call.

Adding a dedicated event file help modemmonitor to know what happen.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-13 21:15:08 +02:00
noneofyourbusiness
3599be95f4
verify numbers with pn 2021-06-09 08:37:20 +02:00
Stacy Harper
e444553ae4
Optimize sxmo_modemtext contact listing
When you number of conversation start to grow, it rapidly take some
seconds for the menu to open itself. The [ -d "folder" ] test really is
uneficient.

This simplify this part as we now ask sxmo_contacts to only list texted
contacts.
2021-06-09 08:37:19 +02:00
Maarten van Gompel
f10d6cddaa various minor shellcheck fixes 2021-06-06 15:39:38 +02:00
Stacy Harper
98bd4b2f0d Make sxmo_modemtext killeable with gesture
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-06 10:39:00 +02:00
Stacy Harper
b4686caa9c Handle outgoing terminated calls as well
This make cached event to pilles up and prevent some incoming call
events to works correctly.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-06 10:22:41 +02:00
Anjandev Momi
725d89d6d6
Rework the sxmo screenlock 2021-06-06 09:41:36 +02:00
noneofyourbusiness
1121e29b3e replace "st -e" with sxmo_terminal.sh and edit it to use st -e instead of st
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-04 21:50:59 +02:00
Maarten van Gompel
eb34a970cb
TERMMODE was used but not set in sxmo_modemtext.sh + sanity check for sxmo_terminal
(fixed the shellcheck problem)

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-05-23 14:37:11 +02:00
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