Commit Graph

41 Commits

Author SHA1 Message Date
Peter John Hartman
f8c9138739 dialer: don't show group contacts
There's no need since you can't *dial* them, and it makes narrow-as-you-type searches annoying.
2023-03-23 13:42:44 -05:00
Willow Barraco
79440aaf1e Make proximity lock a real and dedicated sxmo state
This is a new approach to cleanup and fix issues we have with the
proximity lock. Discussed between Peter and me over irc.

We set "proximity[un]lock" in SXMO_STATE. This allow the input handler
to ignore power buttons while in this state. We then can't manually
change states anymore. It become possible to configure dedicated
hardware buttons trigger, or gesture trigger, to manage the current
call while in this state, by example.

The proximitylock also setup exclusive flock over the state lock
file (as other state switcher does). It prevent other state scripts to
trigger and to break the state consistency.

We stop the idle_locker to prevent 120s, and 8s timers to move the sxmo
state deeper.

When proximitylock stop, it execute back the initial state script,
to return to initial state.
2023-02-18 08:16:26 +01:00
Peter John Hartman
eb199202d7 remove system proximity lock
I'm not sure if a user would ever want to just turn on proximity
lock, and it does kind of make the code ugly and complicated.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-02-16 10:02:14 +01:00
noneofyourbusiness
5d9bc00912 replace 'pn' with 'pnc'
Signed-off-by: noneofyourbusiness <noneofyourbusiness@kolabnow.ch>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2023-01-13 20:36:58 -08:00
Peter John Hartman
4a64e8e999 modemcall: prevent user from making call in call
For now, on pinephone, this will crash the modem. :P

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-10-22 21:04:10 -04:00
ArenM
d3058f1d18 Move call state files into a subdirectory
On arch the dialer was crashing because systemd put a directory in
XDG_RUNTIME_DIR that wasn't readable by the user, and find was searching
XDG_RUNTIME_DIR recursively for call state files to delete.

Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-07-06 13:26:32 -05:00
Stacy Harper
bcb8a64613 Avoid showing empty lines on menus
Was easy to produce : Disable wifi with the Config menu then
go to the Networks menu.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-07-05 19:32:20 +02:00
Zach DeCook
03ac6bcf19 proximity lock: Use events instead of polling
Note: sxmo_daemons leaves this dangling, the next patch is required
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-04-23 12:07:53 +02:00
Stacy Harper
73a2813d76 Rework calls
We need the recent -S (status) command to probe the real state of
callaudiod.

- Lot of cleanup and refactorisation

Most of the code has been moved to a better place. The call audio
setups, the pickup action and the incall menu now are three different
things we can call individually.

- Handle failures individually

Every important task as the mmcli command or volume settings should warn
a urgent message to the user if they failed.

If we failed to setup audio, or to pickup the call then we dont even try
to open the incall menu.

- Made the incall_menu closeable and re-opennable

You can close the incoming call menu and the incall menu and re-open
them from any menu.

To make this possible I moved some of the responsibilities to the
modem monitor that trigger action after modem manager signals. We then
check at this point if it was the last call and do some cleanup if so.

- Initial work for concurrent calls

Added some code to the hooks and the modem checkfinished and
checkincoming calls to handle those cased. If you are in a call and someone
else try to call you, we refresh the incall menu and new entries will allow
you to switch calls.

- The incall menu isnt sticked to one call

This menu itself doesnt need a CALLID argument. It allow us to
manage every active call. We should be able to hold and hangup and
switch calls as we want.
2022-03-25 21:29:30 +01:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Peter John Hartman
16e932d39d Use runtime dir rather than cachedir for phone
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-26 16:57:52 +01:00
Peter John Hartman
0faeb8a42c sxmo_log fixup: two oopses
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-26 16:42:28 +01:00
Peter John Hartman
18f0fa9149 Add sxmo_log and sxmo_debug functions
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-24 21:03:30 +01:00
Stacy Harper
4f9e89fa5e Cleanup profile.d/sxmo_init.sh
- Should only export SXMO_ prefixed variable to avoid noise
- Should not export env variable when sxmo is not running
2022-01-24 20:38:54 +01:00
ArenM
667380a4f4 sxmo_modemdial: refactor
modemdial doesn't have any long running child processes, so killing them
is totally unnecessary. Also fatelerror was never called after the phone
call was started so it the cleanup it did was unnecessary.

staceee edits:

This script was ugly and needed a rewrite. Aren did the first parts and
I completed this patch.
2022-01-24 20:38:45 +01:00
Stacy Harper
9a30ea0d49 Remove last kill -9 0 from this ugly modemdial.sh script 2022-01-17 20:30:44 +01:00
Stacy Harper
1bdec6b825 Remove wrong and useless number checking before starting the call
Someone reported they cant dial *123. Anyway we dont use grep to check
phone numbers for a while. Let the user try to dial whathever they want.
2022-01-17 20:18:58 +01:00
Stacy Harper
57c5ee2352 Refact: status bar
The current sxmo status bar cause a high cpu usage periodically. It was
working by triggering a script that build the whole line.

This is a proposition to improve this implementation:

The design is very simple. We got a root dir that contains files. We
will cat those file contents sorted by the file names.

This way we can update a specific part and the rewriting will then be
very light.

Some abstraction to make it simple:

$ sxmo_status.sh show

To display the current content

$ sxmo_status.sh debug

To help fuzzy developpers like me

$ sxmo_status.sh watch

To watch updates of the component files. Will stdout the new line on
change.

$ sxmo_status.sh add 99-time "11:35" # or
$ printf "11:35" | sxmo_status.sh add 99-time

To add or re-write the component 99-time with the content "11:35"

$ sxmo_status.sh del 99-time

To drop a component

Then, to wrap some of the sxmo status bar component we will still use
the statusbar hook. It make it easy for the user to override or drop
some components.

$ sxmo_hooks.sh statusbar time

To set the time based on the current time. Here other existing
components:

$ sxmo_hooks.sh statusbar call_duration
$ sxmo_hooks.sh statusbar modem
$ sxmo_hooks.sh statusbar modem_monitor
$ sxmo_hooks.sh statusbar wifi
$ sxmo_hooks.sh statusbar vpn
$ sxmo_hooks.sh statusbar battery
$ sxmo_hooks.sh statusbar volume

Or to rewrite everything:

$ sxmo_hooks.sh statusbar all

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:30:40 +01:00
Peter John Hartman
dd4ad00ff7 statusbarupdate: add caller for debugging purposes
This might be useful as well in general.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-29 21:46:27 +01:00
Zach DeCook
6274f1f222 shebangs: change to /bin/sh
Any sane linux system will have a posix compliant shell at /bin/sh
This change will allow us to better detect running scripts using pgrep.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-20 14:29:25 +01:00
Stacy Harper
291d1bcc75 Reverse contact name and phone number order
This make long composed phone numbers to display the name before it.
Witout it, group chat names will not be displayed in the menus
2021-10-31 10:57:15 +01:00
Stacy Harper
afe6abef8e MMS Support
In sxmo_modemmonitor.sh checkfornewtexts() we should skip MMS and SMS WAPs,
which will be SMS messages with text of "--" or no TEXTDATA at all.   Hence,
there are a couple small checks in checkfornewtexts() to do that.

As well, there is a further dbus-monitor call in sxmo_modemmonitor.sh that
monitors org.ofono.mms.Service for 'MessageAdded' to process a new MMS messages.

Most of the action happens in sxmo_modemmonitor.sh processmms().

An MMS message might be either a message with an attachment to one recipient
OR a message with multiple recipients ('Group Chat') and no attachments (or
some attachments).

Attachments get placed in ~/.local/share/sxmo/modem/$PHONENUMBER/attachments/.
They are named $PAYLOAD.jpeg, $PAYLOAD.mp3, etc., where $PAYLOAD is the unique
id that mmsd-tng assigns the mms and stores in ~/.mms/modemanager/.  (Note that
since the PAYLOAD file remains on the filesystem, we could just re-extract the
attachments whenever we want them.  This might be an improvement down the road.)

If there are multiple recipients, we will make a "unique" new phone number out
of *all* the numbers involved (to and from) for each group chat.  For instance,
if you and Bob and Suzie are on a group chat you will have a number like
+15551234567+16661234567+17771234567 in ~/.local/share/sxmo/modem. You can
treat this like a normal number (i.e., give it a contact name, reply to it,
etc.)

Once an MMS message has arrived, one notification will be made like normal.

If there are attachments, clicking on the notification will open them all using
sxmo_open.sh.

You can also go to the message (via Texts) and click View Attachments to run
sxmo_files.sh on the attachments directory.

You can also Add an attachment when you compose a message.  There is a basic
ability to Delete attachments too.

I've also reversed the contact lists so the CONTACTNAME is on the left and PHONENUMBER on
the right, otherwise with large phonenumbers it was hard to see who the CONTACTNAME is.

=== MMSD-TNG CONFIGURATION TIPS AND TRIPS ===

sxmo's mms requires mmsd-tng that includes the mmsctl program.  Right now, this is
in the latest git head.  See https://gitlab.com/kop316/mmsd/-/merge_requests/52.
To compile with this on edit meson_options.txt and set mmsctl to true.  Then build as normal
via mmsd-tng's README.  (We can also just do: gcc -o mmsctl mmsctl.c -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -ldbus-1 -ljson-c)

sxmo's mms does not require any configuration on top of what is needed to get mmsd-tng to work.
However, mmsd-tng can be a bit of a tricky thing to confugre, so here are some tips:

1. mmsd-tng includes example configurations in its README. A helpful list is here:
https://gitlab.gnome.org/GNOME/mobile-broadband-provider-info

Here is an example (works with "Mint Mobile" which uses T-Mobile):

~/.mms/modemmanager/mms

[Modem Manager]
CarrierMMSC=http://wholesale.mmsmvno.com/mms/wapenc
MMS_APN=Ultra
CarrierMMSProxy=NULL
DefaultModemNumber=NULL
AutoProcessOnConnection=true
AutoProcessSMSWAP=true

[Settings]
UseDeliveryReports=false
AutoCreateSMIL=false
ForceCAres=false
TotalMaxAttachmentSize=1100000
MaxAttachments=25

2. mmsd-tng must use the *modem's* dns to resolve mms files.  Since
NetworkManager rewrites /etc/resolv.conf with both wifi and modem active, I
found it easiest to have a static /etc/resolv.conf and to set
/etc/NetworkManager/NetworkManager.conf dns=none.
2021-10-31 10:57:13 +01: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
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
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
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
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
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
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
Serge E. Hallyn
cbeaecbef5 sxmo_modemdial.sh: quiet the grep
When I try to dial a call from 'more contacts', I get

Attempting to dial: +19362396134
Starting call with CALLID: 0
error: invalid call string specified: 'More contacts
0'

This is because dialmenu() is getting an extra 'More contacts'
prepended to the callid it returns on stdout.  Make the grep
which is causing that quiet using -q.

I'm not sure why this isn't hitting everyone else.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2020-11-02 22:24:37 -05:00
Reed Wade
65d9d60ff1 Add more contacts choice to contact list
The dialer only included recent callers, but there was no way to access
the full contact list (contacts.tsv). I added a "more contacts" options
that calls sxmo_contacts --all, providing an alphabetically sorted list
of all your contacts. It also works for the texting menu.

This is a cleaned up version of an earlier patch by Maarten van Gompel.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-11-01 17:58:25 +01:00
Miles Alan
d713b19199 Use sxmo_statusbarupdate.sh script instead of direct calls duplicated logic 2020-07-12 11:38:31 -05:00
Miles Alan
87c99ec024 Use USR1 signal instead of update file for updating statusbar 2020-07-12 11:32:02 -05:00
Anjandev Momi
07119a7085 make dmenus with contact names case insensitive
Signed-off-by: Miles Alan <m@milesalan.com>
2020-07-07 23:31:28 -05:00
Miles Alan
f058e17369 SIGKILL on close menu in dialer 2020-06-29 19:54:15 -05:00
Miles Alan
e3f50e9d1b Only show entries to text for directories that exist; fix number bugs 2020-06-29 15:24:30 -05:00
Miles Alan
a032e4923e Remove +1 stripping from numbers in modem scripts
Note prefix stripping was unreliable because any +1XX number would break things.
The advice should be to always dial with +1 / international prefixes and store
contacts in your contacts.tsv with international codes; this way we avoid any
duplicate errors since we can be assured things in mmcli always come back w/
international prefixing automatically.
2020-06-29 11:43:22 -05:00
Anjandev Momi
f95cb51984 add contacts.tsv integration to call and text apps
Signed-off-by: Miles Alan <m@milesalan.com>
2020-06-29 10:30:54 -05:00
Miles Alan
c119ab0145 Pull dialing functionality into seperate script; allows in-call check to be valid 2020-06-27 21:28:46 -05:00