8 Commits

Author SHA1 Message Date
Willow Barraco
f5dd68bc75 Reset sxmo_run_periodically.sh wait first feature 2023-04-28 11:57:53 +02:00
ArenM
2691b8cca6 Refactor presuspend checks to run infrequently
autosuspend calls the presuspend check when the kernel locks are clear,
and it hasn't been called recently. If we always call it, there's a risk
that running all checks could take too long and we'll fail to suspend
often.

Successfully exiting means that there is nothing going on, so the system is
free to suspend within a reasonable timeframe (something like < 10 seconds).

All the checks currently use the (default) delay wait mechanism, but I
would like to try to write others. For example `playerctl -F` could be
used when playerctl is blocking suspend. Unfortunately managing spawned
jobs and race conditions is harder than it seems at first glance.

Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-04-28 11:39:32 +02:00
Willow Barraco
75cf104db3 sxmo_run_periodically.sh avoid spaming kill errors 2023-03-30 17:40:26 +02:00
Willow Barraco
ea27c8d785 Avoid crazy edge case if the first wake lock checker is delayed 2023-03-30 17:40:26 +02:00
Stacy Harper
a2405f6d57 Fix shellspec 2022-11-15 13:41:55 +01:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Stacy Harper
81edd1167e Avoid buguy state if screeoff for a long moment.
Make sxmo_run_periodically to manage correctly its subprocess to avoid
multiple holdexec sxmo_suspend.sh
2022-02-09 19:44:58 +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