Commit Graph

107 Commits

Author SHA1 Message Date
Willow Barraco
e26825b803 BEMENU_OPTS: support fixed height and borders 2023-05-12 08:42:45 +02:00
Peter John Hartman
d27f7e108d normalize smslog for mms and sms
This implements sxmo_hook_smslog.sh which allows the user to establish
how logging looks.

We were also inconsistent on this: mms would set the contact names in
the logfile whereas sms ony gave the numbers and used a sed to convert
them.

I tought about setting this in sxmo_hook_tailtextlog.sh, but:

(1) processing on a tail is a PITA
(2) one can get the "raw" data for sms.txt from modelog.tsv.

I implemented a basic and a fancy option, but it is really up to the
user.

I also implemented sxmo_contacts.sh --name-or-number and so was able to
clear out the '???' code all over the place.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-03-03 16:33:14 +01:00
Peter John Hartman
79f4132b32 call hooks: minor cleanup
The comments were wrong, and mute_ring was sending CONTACTNAME, which
was also wrong.
2023-01-19 19:43:33 -06:00
Stacy Harper
a2405f6d57 Fix shellspec 2022-11-15 13:41:55 +01:00
ArenM
4201985e17 Support using a physical keyboard for dtmf tones
Opening a terminal window to read dtmf tones makes it possible to use a
physical keyboard to enter them. Not needing to read keys from
{wvkbd,svkbd} -o should make things generally more robust too.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-10-31 10:26:24 +01:00
Peter John Hartman
2da6057467 modemcall: clean up files on crash
If we attempt to make an outgoing call whilst on an outgoing call, the
modem crashes, and we can't make any new calls until we

rm -rf $XDG_RUNTIME_DIR/sxmo_calls/*

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-10-22 20:51:34 -04:00
Peter John Hartman
08b35c8643 call: change 'Mute' to 'Ignore'
This makes more sense and is less confusing with our actual 'mute'
options.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-10-03 09:42:52 +02:00
Peter John Hartman
5336a35556 incallmenu: added note about mic not actually work
Didn't notice this comment. Verified that muting mic has no effect
in call!  Placed the comment in a more obvious spot (for me at
least).
2022-10-02 06:19:43 -05:00
Peter John Hartman
655d49ed04 Ring&Vibrate Mode cleanup
This makes two entries and cleans up some code.
2022-10-02 06:19:43 -05:00
Peter John Hartman
1ca1b17be8 Implement pulse functions in menu.
This patch is *just* an implementation of the pulse audio menu.
(The bugfix for call mode is now a separate patch, so too the
additions to statusbar.)

1. Implements the sxmo_audio.sh menu for pulse completely using ONLY
   pactl (so we don't need pamixer).
2. Cleans up the InCall menu.

A further patch will remove extra alsa functions.
2022-10-02 06:19:43 -05:00
Stacy Harper
0d5fcf0014 Toggle the speaker mode instead of relying on the oudated bemenu entry
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-08-24 19:48:54 -04:00
Stacy Harper
9aa7c5bb44 Toggle to vibrate ring mode while in call
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-08-09 23:30:59 +02: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
Peter John Hartman
6d34848635 fix sxmo_hook_hangup
317bf34f2e introduced a small typo in the
comment.  Also the 'hangup' hook should *not* call the missed call hook,
since these are in principle distinct.  (On my machine, for instance, I
have missed calls e-mailed to me; but I don't want hangup calls e-mailed
to me.)  (See also sxmo_hook_discard.sh)

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-07-06 09:05:58 +02:00
Stacy Harper
858005e608 Ignore hangup error if the call is just finished
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-07-05 19:42:32 +02: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
Stacy Harper
317bf34f2e Add a hangup hook when you hangup the call 2022-07-01 11:12:17 +02:00
Stacy Harper
606f62ba77 Add a safety entry on the incall menu to re-set the call audio
This "Reset call audio" entry re-trigger a sxmo_modemaudio.sh
setup_audio. It can be usefull when connecting/disconnecting earphones
and if pipewire automatically toggle the current mode.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-04-03 10:10:48 -05: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
Zach DeCook
ffcfa6f6a4 icons: Change into a hook
Fixes the icons hook to be where the migration script moved it.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-14 18:18:55 +01:00
Stacy Harper
92c258f990 Make sxmo hooks scripts in PATH
We then add /usr/share/sxmo/default_hooks/ to the PATH (see
sxmo_init.sh)
2022-02-11 17:04:11 +01:00
Stacy Harper
704f637236 Rework the modem call menu
- Simplify the menus code

We use new patterns to make it simple to read the code

- Use callaudiod

This script isnt pulseaudio/pipewire perfectly compatible. It doesnt
create nodes that are natives and managed by those audio daemons. But it
connect to thoses to know the audio setup and offer a simple cli to
manage basic commands as speaker toggle by example. It also handle ootb
the connected jack audio devices which make our life way simpler.

This solution isnt perfect but it is better than the megi script we use
atm that is pinephone specific.
2022-02-09 19:11:23 +01:00
Nihal Jere
c309751b33 rename sxmo_vibratepine to sxmo_vibrate
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:12:45 +01:00
Stacy Harper
cdac52dc7c Use virtual keyboard as dtmf menu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-29 11:03:03 +01:00
Stacy Harper
f2c0ee8000 Rework: audio controls and menu
- Use one script
- Simplify code
- Pulse compatible

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-01-27 01:23:57 -05: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
b52b971dee modem_n -> modem -m any
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-25 13:19:29 +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
Stacy Harper
238aa38efc Refact: commons loading
- Move sxmo icons in sxmo_icons.sh

This script should be loaded when icons are needed

- Move init env variable setups in a /etc/profile.d/sxmo_init.sh

This script is loaded by tinydm and for ssh/tty logins.

The logged in user can re-trigger check_sxmo_wm if they toggle wm.

- sxmo_commons.sh now only load aliases. It can be loaded by scripts to
ensure busybox compatibility

- moved some parts of ~/.config/sxmo/xinit to ~/.config/sxmo/profile

This file also is loaded just before starting sway. It goal is to setup
env variables dedicated to sxmo

~/.config/sxmo/xinit only goal is now to trigger some dwm dedicated
things (as ~/.config/sxmo/sway can start exec commands to)

To recap, loads orders are :

tinydm:
	/etc/profile.d/* # do not set SXMO_WM
	~/.profile

	sxmo_winit.sh:
		~/.config/sxmo/profile

	sxmo_xinit.sh:
		~/.config/sxmo/profile
		~/.config/sxmo/xinit # to start sxmo_hooks.sh

ssh/tty:
	/etc/profile.d/* # will set SXMO_WM
	~/.profile

- unify sxmo_winit.sh and sxmo_init.sh

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:31:00 +01:00
Stacy Harper
d32bc7e02e Refact: Daemons management
Add a sxmo_daemons to manage all sxmo daemons

$ sxmo_daemons.sh start mmsd mmsdtng
$ sxmo_daemons.sh start network_monitor sxmo_networkmonitor.sh
$ sxmo_daemons.sh start sleepy sleep 2

$ sxmo_daemons.sh start network_monitor sxmo_networkmonitor.sh
-> This will stop the old daemon and start a new one

$ sxmo_daemons.sh running network_monitor
network_monitor is still running
$ echo $?
0

$ sxmo_daemons.sh running unknown
unknown is not running
$ echo $?
1

$ sxmo_daemons.sh running sleepy
sleepy is not running anymore
$ echo $?
2

$ sxmo_daemons.sh running network_monitor -q && echo "tada !"
tada !

$ sxmo_daemons.sh stop network_monitor
$ sxmo_daemons.sh stop all # to stop every managed daemons

We can now start, stop and check daemons status with ease. When
dwm/sway shutdown, we stop all daemons. Restarting or toggleing window
manager cannot leave any dangling daemons anymore.

As you can see, all daemons now start from the start hook. We gave the
full power on the user to disable or add daemons.

This patch is painfull cause I had to make sure every daemons behave
correctly and shutdown gracefully when killed (which was definitely not
the case !).

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:30:49 +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
noneofyourbusiness
1cf6a93fe5 replace occurences of date -Iseconds and date --iso-date-8601=seconds with a more portable +%FT%H:%M:%S%z
noticed that this is a problem at all because the modem log was incomplete after some updates

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-01-07 21:17:25 -05:00
Peter John Hartman
ccd52612a0 modemmonitor: add more verbose output
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-02 14:28:09 +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
Peter John Hartman
7075fd1bfb modecall: print number instead of name if ???
This makes Incming Call behave like other cases. If the # is not in
contacts, then print the # rather than "???"

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-10 13:43:13 +01:00
Peter John Hartman
f3a8152f06 Adjust height of PICKUP/HANGUP dmenu.
Fat finger patch for pickup/hangup.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-09 22:42:58 +01:00
Peter John Hartman
68c8f4d7e7 Incoming call use contacts.sh --name
This one should apply... not sure what was wrong with last.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-11-22 13:40:52 -05:00
Peter John Hartman
42cab3d25b Prefix call notification with a title
As this solve notification messages with newlines.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-11 15:03:44 +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
Avalon Woodard
71d8fa7b6f fixed mute so temp file is named correctly
Noticed that a missed call notification still came in on muted calls.
After this fix, modemmonitor checkforfinishedcalls identifies cachefile
correctly.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-22 19:08:49 +02:00
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
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
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