stderr is just an alias to sxmo_log, so by replacing it with sxmo_log we
save a little code.
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
This fetches the network interface type from NetworkManager and passes
it to the network status hooks, as well as the statsubar. Doing this
should make the defaults independent of interface names.
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
If a interface is removed when it goes offline (this seems to happen
when using wireguard with wg-quick), we can't get the interface name,
and the network hooks don't work correctly.
Signed-off-by: Peter John Hartman <peterjohnhartman@gmail.com>
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>
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>
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>
1. Our original version of sxmo_networkmonitor.sh was checking
interface 'org.freedesktop.NetworkManager' when it should be
'org.freedesktop.NetworkMananger.Device'. By chance, the 'up'
detection worked, but the others (down, pre-down) did not.
2. It also did not check for pre-up.
3. Also, the /etc/NetworkMananger/dispatcher.d/10-statusbarupdate.sh
is both not needed and actually wouldn't have been working, since
it would have run as root.
4. Finally, sxmo_networkmonitor.sh was not being stopped when the wm
ended (so it would break if you did Toggle WM).
Hence, this patch fixes all of the above. We *could* down the road
move all of this into /etc/NetworkMananger/dispatcher.d / pre-up.d,
etc., since what we do here is basically what those scripts do.
However, that would require somewhat complicated doas rules, since
those scripts run as root.
I kind of think this is the simpler approach after all.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
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>
This implement a dbus monitor for networkamanger and is useful to
start/stop/restart certain things in user-defined hooks when
connectivity is gained/lost. By default all
it does is ensure the status bar is updated quickly to reflect the
network status.
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>