Commit Graph

54 Commits

Author SHA1 Message Date
Peter John Hartman
aea5a73f51 notification: another fixup to devices without led
Oops, found a small bug where it didn't update statusbar if you clicked
on the message.  So this one should be good to go.

In re this:
377744c95b

There were two problems with that patch:

1. The check for SXMO_NO_LED never worked so every device was getting
   it.
2. The change to notificationwrite broke notificationwrite so no popups
were happening.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-11-07 20:01:33 +01:00
Anjandev Momi
377744c95b devices without leds: show number of notifications in statusbar
On some devices (ie. poco f1), we do not have LED support. On devices
without LED support, lets show the number of notifications in the status
bar. Otherwise, it's easy for the user to miss a notification.

Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-10-13 06:04:56 -05:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Stacy Harper
de71ed7b34 Add a sxmo_uniq_exec.sh to ensure concurrent free script execution
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-02-23 05:13:36 -06: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
28722fe2a6 Fix the "loosing touch" issue: ~mil/sxmo-tickets/451
The issue was crazy :

- The phone is in crust
- Your modem wake the device cause of an incomming call
- Our modem monitor script detect this incoming call
  -> We launch the pickup menu
    -> it start the proximity locker
      -> if no proximity, it unlock the device
        => power on the screen, enable touch
  -> We write a notification
    -> if in "screenoff" mode, we "lock"
        => power on the screen, disable touch

Those two => occurs at the exact same time so we fall into an
inconsistent state.

To fix the issue, we move the "screen on the device on sms to see the
notification" behavior in the "sms" hook.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
2022-02-11 15:16:49 -06: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
c23ede100d Rework sxmo states
Some devices need more flexible states. Wart is working on the
Pinenote and in this device, a locked and off mode looks useless and
wrong. We have to be able to offer more diversity with our states.

We was determining the current state based on some input device state.
Are they enabled/disabled ? This brings lot of constraints :

- We cannot have abstract states. That would be usefull to have
dedicated keybinds at some points. We could have very dedicated
workflows.
- We have to maintain complex code to checks tons of different input
devices. Pinenote brings a touchscreen but also a stylus. We have to
make crazy assomptions to determine we are in a "locked" state.

With recent patches from wart, lot of code already has been moved to
hooks. The hooks "unlock", "lock", "screenoff" got everything to enable
and disable input and output devices. The user then can adapt it to
their need.

We will keep our 3 different state with those hooks. We will also keep
some of the code remaining from sxmo_screenlock.sh to sxmo_suspend.sh.

Calling sxmo_suspend.sh place the device in suspension. This is not a
state, this is a time travel.

We now store the current state in a file SXMO_STATE. Checking the
current state is way faster and it really is perceptible while using the
phone.
2022-02-09 19:11:24 +01:00
Peter John Hartman
662d5eada3 sxmo_log: a few more
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-25 13:17:13 +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
Peter John Hartman
e2fab2f771 notification: use sxmo_led.sh not sxmo_setled.sh
OK! This is the one! LOL sorry for spam.

The reason we never noticed this is that make install won't remove 'old'
files like sxmo_setled.sh.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-18 17:29:12 +01:00
Peter John Hartman
5dd7115112 fix closeall notification
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-18 13:32:51 +01:00
Peter John Hartman
302b967c4a notification: use eval and simplify notif file removal
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-18 13:29:36 +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
db8681e279 Trigger a notification syncled on self removal
This replace :

63af8077 notification: fix stuck 'green' led

For some reason, the notifywait triggered by selfs rm trigger after the
file really is removed. This tend to happen if multiple notify watch
target the same file (duplicated notifications by example).

To solve this, we enforce a syncled after removing the file.
2022-01-02 18:28:45 +01:00
Stacy Harper
5b6c37c2d0 Revert "notification: fix stuck 'green' led"
This reverts commit 63af80771c.
2022-01-02 18:28:44 +01:00
Peter John Hartman
63af80771c notification: fix stuck 'green' led
Sometimes it takes a while for the rm to go through, so bumping this to
1s should do the trick.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-02 16:09:21 +01:00
Clayton Craft
9b4d608626 core/setled: change param to percentage of max brightness
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-02 14:47:37 +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
5400a9eeec Small fix to clear notificaitons.
Problem: If you clicked Clear Notifications the inotifywait filename
would linger.  This should fix that  There likely are more clever ways
to accomplish this than what I propose in this patch, but it works for
me (tm).

Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-12-09 22:52:49 +01:00
Stacy Harper
9d93d72e2c Fix notification dismiss all on Sway
We add abstraction arround dunstctl to use makoctl on the Sway
environment
2021-11-21 10:40:52 +01:00
Peter John Hartman
d0e39a3d62 Allow 'escp' to cancel notifmenu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-16 20:28:42 +01:00
Peter John Hartman
60a0de9e0f Fix to remove tr: write error: Broken pipe
I'm not quite sure why the 2>/dev/null is needed, but otherwise
sway.log would include things like:
tr: write error: Broken pipe
tr: write error

Maybe there is a more elegant solution?

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-11-11 14:58:01 +01:00
Stacy Harper
ac0a40e3b2 fix issues with the green led for notification
I move the syncled after handling the notification cause it can be
instandly dropped. Plus I simplify this method to not enforce green 0
but only if no notification is present.
2021-11-03 16:20:43 +01:00
Stacy Harper
42439c853e Fix the watch file name 2021-11-03 16:20:43 +01:00
Stacy Harper
a428f2f570 Move the "is already open" check on notification write to the monitor
This make the phone to react correctly when notifying (sound, screen on,
etc) while still automatically marking the notification as read if open.
2021-11-03 16:07:57 +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
71b405074a Lock the screen on notification while off
Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-10-29 02:57:02 -04:00
Maxim Karasev
1e20a2223b Rename sxmo_setpineled.sh to sxmo_setled.sh, add bq-paella support
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-31 16:52:30 +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
Nihal Jere
ce3f2ea319 replace setpineled C program with a shell script
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-11 22:27:28 +02: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
ae784d0ab0 Fix the notification menu usage when notification are doubled
For some reason, some notifications get doubled (probably cause of
a modemmonitor issue). Those doubled notifications cant be used with the
current notificationsmenu cause the two entry matches the picked text.

This make the first one to be picked.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-06-22 15:01:32 +02: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
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
9346bf6e15 shellcheck fixes after sorting notifications menu 2020-12-23 12:13:52 +01:00
Julian P Samaroo
0c2b11c2f3 Sort notifications menu
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-12-23 12:12:04 +01:00
Maarten van Gompel
7fb7cd70f3 various indentation fixes (spaces to tabs and stripping trailing whitespace) 2020-11-20 18:10:17 +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
7066b54897 Give notification file to the notification hook
Signed-off-by: Reed Wade <reedwade@misterbanal.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-11-08 12:21:56 +01:00
Anjandev Momi
bfba94b93f handle missing and uncreatable notifdirs more gracefully
Original patch by ~kgp445

https://todo.sr.ht/~mil/sxmo-tickets/94
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2020-10-31 18:30:25 -04:00
Maarten van Gompel
8dc0b9ca45 Implemented suggested fix for Notifications menu fails with special characters (#78) 2020-10-31 23:01:23 +01:00
Reed Wade
1edb932f44 fix a bug on picked notification file determination
If a notification body include a double whitespace, the PICKEDNOTIFFILE
computation fail to match cause we striped them when building the dmenu
choices.

To give an example, try to write this notification as

$ sxmo_notificationwrite.sh "random" \
"st -e tail -n9999 -f \"$HOME/.config/sxmo/xinit\"" \
"$HOME/.config/sxmo/xinit" \
"this body  is broken"

This patch fix this bug.

(Maintainer note: I changed the awk invocation to use tr, as suggested
by anjan)

Signed-off-by: Reed Wade <reedwade@misterbanal.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2020-10-31 22:55:50 +01:00
Julian P Samaroo
1253dcd5f1 Added Clear Notifications option to menu 2020-09-12 22:51:43 -05:00
Miles Alan
68641aab4f Move LED setting to be indpendent of notification hook 2020-08-22 17:28:14 -05:00
Miles Alan
46acb72dd7 Kill in-progress notification hooks if the notif dir is empty 2020-08-22 16:59:56 -05:00
Miles Alan
747da7863c Fix shellcheck 2020-08-22 16:45:49 -05:00