Commit Graph

82 Commits

Author SHA1 Message Date
Peter John Hartman
9a22b0835d sxmo log: if no XDG_STATE_HOME use HOME
If someone ssh's in and runs our commands, for instance.
2023-02-22 07:39:43 -06:00
ArenM
480ee9a946 xdg_data_path: don't always check in /usr/share
The xdg base dir spec specifies that /usr/local/share:/usr/share should
be used as the default, but not that they should always be included. We
set XDG_DATA_DIRS to this in sxmo_init.sh, so we would always duplicate
entries in /user/share without this.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-02-18 08:40:01 +01:00
Stacy Harper
4a4e5cd6cc move to sxmobar
This also alias sxmobar to the old adapted script in case the dependency
is missing. The api of sxmo_status.sh changed to be sxmobar compatible.
2023-02-01 16:42:21 +01:00
Peter John Hartman
8b34dd727b log to our own file
This really makes things more sane for debugging.  Some noise gets lost,
but you can still always tail -f ~/local/state/superd/logs/* sxmo.log
tinydm.log to catch the context.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-01-25 09:58:39 +01:00
Stacy Harper
f436475c23 Drop busybox aliases
As discussed with Aren over and over again, there is no easy, and fast enough
way to alias those in a smart way.

Cause this is causing issues on other distros than Alpine, we drop them
completly.

I think we should find a way to check those in the CI tests to
keep an eye on non busybox api usages contributors may try to use.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2023-01-03 07:15:17 -06:00
Jochen Sprickerhof
69fb14a291 Add fallback XDG_DATA_DIRS
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-12-05 11:46:46 -08:00
Stacy Harper
a2405f6d57 Fix shellspec 2022-11-15 13:41:55 +01:00
Stacy Harper
9fa7625ffc Fix sxmo_mutex.sh lockedby
Avoid sxmo_debug to exit 1
2022-09-28 14:06:10 +02:00
Peter John Hartman
ec993316b1 sxmo_debug: make it only print if SXMO_DEBUG 2022-09-25 16:35:12 -05:00
wentam
88600bedf1 Use XDG_DATA_DIRS rather than hardcode /usr/share
This is more flexible and makes packaging much easier - especially
on distros using non-standard paths like NixOS

This version of the patch has xdg_data_path default to 1 instance,
making usage simpler. The function is also documented a bit more
clearly.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-07-01 10:28:02 +02:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Stacy Harper
88efb42f70 Revert "SXMO_DEBUG"
This reverts commit b3eb4f15b0.
2022-02-16 09:55:20 +01:00
Peter John Hartman
b3eb4f15b0 SXMO_DEBUG
If set, then print sxmo_debug lines, otherwise don't.  Default is unset.
2022-02-15 19:16:21 -06:00
Stacy Harper
1821e5eebb Enforce busybox flock and sed 2022-02-15 09:42:07 +01:00
Peter John Hartman
8bfd364dda busybox pkill 2>/dev/null
If a system actually doesn't have busybox pkill, then this'll spam up
the logs with pkill: applet not found

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-12 11:37:16 +01:00
Stacy Harper
1b9eae23d4 Use busybox rfkill
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-02-09 18:35:04 -06: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
ca8f63c357 Refact bluetooth menu
- More granular control on devices
- Can restart the daemon
- Can toggle on/off discovering mode
- Can full reconnect a device. Very usefull for autoradio by example
- Use icons

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-01-19 18:53:34 -05:00
Zach DeCook
f86fd54c14 bc: use busybox bc
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-18 13:15:54 +01:00
Stacy Harper
a8d698c987 Also alias bemenu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 12:21:31 +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
ad06db432b Refact: leds usage
- Use one single sxmo_led.sh script

$ sxmo_led.sh blink red
$ sxmo_led.sh blink red blue

$ sxmo_led.sh set red 100
$ sxmo_led.sh set red 100 blue 0 green 100

This script got a simple mutex check to behave consistently while
spamed.

Blinking leds now return to initial state. Make it more easy to use
with long running leds. Plus it also solve the issue of invisible
blinking led if the color already is used.

- Free leds of sxmo lock state

The goal here is to not rely on long running leds for screen lock state.

The typical use case is when the user want to lock the screen while
playing a video. Having a blue led in the eyes really is annoying in
this kind of cases.

Another issue is when the phone is in crust, then the mixup of green
+ red give a not simple yellow. Or when we make a color to blink above
already used leds.

As sxmo now rely on an idle daemon that slowly move it to crust, having
long running leds isnt that mandatory now.

It will also make it more easy for other script to notice the user. By
example, we dont have that much merged leds now.

To avoid this, we would rely more on blinkind leds:

Move to unlock: blinking yellow
Move to lock: blinking blue
Move to off: blinking purple (blink periodically purple while in off)
Move to crust: blinking red

Additionnaly, I added a  icon in the status bar to make it more
explicit if the phone stay locked for a while

- Drop rtcwake that conflict with blinking led and are pretty useless

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2022-01-15 11:30:44 +01:00
Stacy Harper
3d97766e38 Remove duplicated env variable setups
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-01-07 21:38:39 -05:00
Stacy Harper
01fbe5521b Use shm based folded as XDG_RUNTIME_DIR
Fifetime of some of disk type as EMMC is counted in number of writes.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-01-07 21:38:39 -05:00
Peter John Hartman
fbeb08a8e4 sxmo_migrate: use busybox more
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-12-29 12:23:37 +01:00
Peter John Hartman
2055221f73 mms: add option to keep mms file
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-12-27 16:18:01 +01:00
Peter John Hartman
7555c5bf03 mms/vvm: various fixes
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-12-27 16:18:00 +01:00
Stacy Harper
2049117d08 fix some shellcheck issues 2021-12-24 15:58:34 +01:00
Peter John Hartman
ead8ad7271 networks: rework networks interface
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-12-24 15:42:14 +01:00
Stacy Harper
9fd21bab38 Use a DEBUGLOG var to unify this stderr log file path 2021-12-24 14:18:46 +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
fd77c5efdb statusbar: Fix icons.
Force statusbar to use sxmo_common.sh icons. Also cleaned up icons that
were in the 'bad' range (Arabic, etc.)

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-10 20:30:45 +01:00
Peter John Hartman
9de644a7d6 contextmenu: Toggle icons & restart modem daemons
Also includes gesture icon fix.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-10 13:42:14 +01:00
Peter John Hartman
edfd2c9fe7 Toggle icons, gesture icon fix, daemon restart tog
1. The gesture squiggle icon was Arabic so rendered wrong on sway.
2. Changed ON->OFF and OFF->ON to toggle icons.
3. Made Modem Daemon Restart a toggle like other cases.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-09 23:25:07 +01:00
ArenM
9d667a31d2 Disable SC2034 for all of sxmo_common.sh
SC2034 is already disabled for the entire file, but it's disabled for
each variable. Doing it this way saves a bunch of unnecessary comments.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-09 21:24:47 +01:00
ArenM
06eac1885f Fix shellcheck error when sourcing os-release
I tested this on my system before, and it worked fine. But
/var/lib/os-release doesn't exist in the ci images which is causing
problems.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-09 21:24:36 +01:00
ArenM
d1b1786602 Use ID instead of NAME from os-release to set $OS
The NAME field of the os-release file is for a human readable name, the
ID field should be used to determine what system is running.

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-08 13:28:47 +01:00
Peter John Hartman
35376979be Visual Voice Mail.
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-29 21:17:25 +01:00
Peter John Hartman
5974f92d8c Modem Monitor / Idle Monitor on/off like others
Supercedes previous gesture patch, this  adds gestures and normalizes on
off for idle monitor and modem monitor.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-29 20:38:53 +01:00
Peter John Hartman
4a24bbdf75 Refactor modemsendsms and modemtext v2
This is not the final patch, but for those who are interested.  I
noticed two problems with our current MMS setup. (1) we should be
deleting mms as they come in, and (2) there was not a robust error
checking for failed sends.  This patch should fix that (it also adds
some debug stuff that'll be removed in the final version).

Comments on the approach are welcome and appreciated.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-29 20:20:25 +01:00
Sam Bowlby
a610fdedb8 add anki and luakit to app menu
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-27 15:55:54 +01:00
Zach DeCook
aa5060fe9c recommended apps: Add icons rather than generic "item" icon
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-27 13:33:35 +01:00
Peter John Hartman
22996c308d make netstat busybox
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-11-10 16:28:10 +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
cdf1f8c6da fix ssh mode since we dropped xdm-config
xdm-config was adding a /etc/profile.d sxmo script that was setting up
some env variabled. We now miss the XDG_DATA_HOME one that we was not
defaulting in sxmo_common.sh

As we prefer not to enforce those global variables, we will fix this
adding this default to the common script then. Scripts that need it
should load this script anyway.
2021-10-11 20:57:50 +02:00
Anjandev Momi
db6a2588ef Allow user to block texts from numbers with block.tsv config file
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-08 21:24:55 +02:00
Stacy Harper
55985a8f20 Rework the status bar
Goals of this patch :

- display the signal quality

I used a thermometer icon cause there is no available icon with a
filleable bar o_O

- display the currently used network technology (4g, 3g, etc...)

I used the mapping from:

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/blob/master/include/ModemManager-enums.h#L220

Dylan also said:

Anything from POTS to GPRS = 2G
UMTS to EVDOB = 3G
LTE = 4G
5GNR = 5G

- display the modem infos when modemmonitor is disabled

We want to decorelate the modem monitor from the icon. We still want to
know easily if modem monitor is runing but we also want those modem
infos if not.

- simplify the modem state determination (no state file anymore)

The statusbar probe mmcli itself.

- fix the leading timer without call issue

This was caused by the "pgrep -f" command that was matching itself.
Using a simple "pgrep" looks good enough anyway.

- fix some sxmo_statusbar update spaming issues (vol control)

This one point took me a lot of time to findout a good solution. We want
the USR1 kill to be spamable without causing issue to the displayed bar.
We dont want mid rendered bar (half the icons).
We dont want empty bars (empty stdout line).

I use some variable to store pid, smart waits and a better trap function
to make it to works cleanly. Now we can spam statusbarupdate. Only the
last one will actually redraw the bar.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-09-12 19:59:03 +02:00
Maxim Karasev
f7698e4a25 Move operating system detection to sxmo_common
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-09-05 10:07:27 +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
Stacy Harper
cfa15765e2 Fix some shellchecks issues 2021-07-25 09:55:46 +02:00