Commit Graph

48 Commits

Author SHA1 Message Date
hazardchem
7f78a92b18 winit.sh/xinit.sh: added pkill superd before starting WM.
This patch superseeds the following:

https://lists.sr.ht/~mil/sxmo-devel/patches/39336

This should prevent situations where superd still lives and causes issues on start.

Signed-off-by: hazardchem <pthom44@live.com.au>
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-03-03 16:33:13 +01:00
Peter John Hartman
23acac9a4a Move logs to old on start.
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
2023-02-03 13:34:00 +01:00
Stacy Harper
a2405f6d57 Fix shellspec 2022-11-15 13:41:55 +01:00
ArenM
54f5052884 Don't start a dbus session if one is already running
Systemd starts a dbus session bus automatically, and runs user services
on it. When we create our own session bus, we can't talk to those
services.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-08-31 17:23:16 -04:00
Stacy Harper
a1fce6fcf7 export XDG_CURRENT_DESKTOP=sway 2022-04-16 11:13:09 +02:00
Stacy Harper
8b1e08cd37 fixup! WIP: change from sxmo_daemons.sh to superd for 'most' 'daemons' 2022-04-16 11:11:13 +02:00
Anjandev Momi
6f52863501 Switch to superd for daemons we want to monitor
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-04-16 11:11:10 +02:00
ArenM
46cc06b70b call xdg-user-dirs-update in start hook
xdg-user-dirs-update is responsible for creating directories such as
~/Pictures, and is intended to be run during the startup process of the
desktop environment. This adds a dependency on it.
https://freedesktop.org/wiki/Software/xdg-user-dirs/

This also sets up the XDG_PICTURES_DIR environment variable, so we don't
need to do that.

This patch is intended to fix https://todo.sr.ht/~mil/sxmo-tickets/350

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-04-12 22:05:11 -04:00
Anjandev Momi
1123c0f072 Change license to AGPL-3.0-only 2022-03-15 08:00:00 -04:00
Stacy Harper
572320805f Cleanup alsa configs
As we now use pipewire by default, I think most of our alsa configs are
useless now. At least removing them seems to not have any consequences.

- Remove unused alsa_sxmo_enable_dmix.conf
- Remove useless default_alsa_sound.conf
- Remove useless audio setup in the start 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
Maarten van Gompel
b90e94c9bb cleaning up defaults for $SHELL, $BROWSER, $EDITOR 2022-02-05 22:34:12 +01:00
Maarten van Gompel
1c07327fd8 sxmo_migrate: new versioned migration
This patch ensures that user customisations to configuration files and
hooks can be more easily kept up to date when we make changes with new
sxmo releases. We need this because our hooks are modified both by us
and the user, to ensure the user has maximal flexibility and freedom in
adjusting the system to his/her needs; needing a mechanism like this
is the cost for that.

Each config file carries a 'configversion' comment that signals the version of
that particular configuration file. The version is unique for each file
and can be anything (as long it wasn't used before); I suggest a simple
incrementing integer.

Configurations that are out of date are moved out of the way when Sxmo
starts, presenting the system-default for that file instead. This
ensures that users always have a working system after an upgrade. Users
need to run sxmo_migrate.sh to 'merge' the changes.

sxmo_migrate.sh now has several modes (1st parameter):

* interactive: the default mode, shows diffs and prompts the user to
  merge changes for file that are out of date. Like before, but makes
  sure to use the file that were 'moved out of the way' earlier.
* all: same as interactive, but prompts for all files even if not
  out of date
* reset: removes all user hooks and reverts to default configurations, good
  option if a user is stuck somehow
* sync: this is a non-interactive mode automatically invoked from
  sxmo_[xw]init.sh, it takes care of making sure default
  configuration files exist and it checks the configversion, moving
  outdated configs out of the way in favour of defaults.
* state: returns the current state, i.e. lists the files
  that have been marked as needing revision.
  (does not sync by itself)

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-04 16:11:13 +01:00
Anjandev Momi
c579369dbe add configversion check, move configs and warn user if configs too old
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-02-02 20:43:07 +01:00
Peter John Hartman
0735051182 One TRUE (tiny) log to rule them all
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-27 18:03:33 +01:00
Peter John Hartman
aa3a782681 Pipe command -v to dev null
Again, this cleans up logging spam

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2022-01-27 02:11:02 -05:00
Stacy Harper
a4ff999e9b Fix shellcheck issue 2022-01-26 21:45:58 +01:00
Stacy Harper
39c65517ff Fix dbus setup after moving it to XDG_RUNTIME_DIR 2022-01-26 17:41:45 +01:00
Stacy Harper
cf42efe7da fix dbus setup issue on dwm
The "set -o allexport" was preventing $DBUS_SESSION_BUS_ADDRESS to be
available on the xinit then the start hook.

We move and simplify the dbus setup in the init scripts.
2022-01-26 16:32:08 +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
ArenM
a19befd651 Configuration files shouldn't be executable
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-20 21:33:34 +01:00
Stacy Harper
cc3cd13b48 Fix empty TERMCMD
Wart removed the quote to allow TERMCMD with arguments to not being
wrongly detected as absent. But then, empty TERMCMD trigger command -v
without argument and that exit 0. To avoid the cases, we add a last
argument "" as fallback.
2022-01-17 18:09:33 +01:00
Zach DeCook
4c02ccf1b4 TERMCMD: Don't override when passed with arguments
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-17 13:49:18 +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
Zach DeCook
04a1b2c6fa winit: properly fix variable quoting
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2022-01-09 18:06:45 +01:00
Stacy Harper
9d399eeb23 Hide shellcheck issue 2022-01-08 14:32:25 +01:00
Anjandev Momi
33a11c3546 Shellcheck fix: Use shm based folder
This patch fixes the shell script errors from this patch:

https://lists.sr.ht/~mil/sxmo-devel/patches/28036

By applying the changes recommended here:

https://builds.sr.ht/~mil/job/665969
2022-01-07 21:44:08 -05:00
Stacy Harper
d8b0ccba10 Some shellckecks warnings
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
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
Clayton Craft
a9b892930c core/sxmo_winit: clean up old sxmo session processes before starting
If sway crashes, or something else happens such that the stopsway
function and stop hook is not executed, there are a lot of leftover
processes from the previous session.

I renamed swaystop to swaycleanup in this patch, and call it when
starting sway and after sway has stopped. This should make sure that
there are no residual sxmo/sway processes from the previous session when
starting a new session.

Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-12-31 18:38:34 -05: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
bfb644dc45 One Log to Rule them All
First, it was annoying to have to switch logs when on ssh and one
toggles WM.

Second, several apps are WM agnostic: cronjobs,
sxmo_screenlock_deeper.sh, and others.  Rather than force them to guess
the WM just to log their activities, it seems easier to just have "One
Log to Rule Them All", namely, sxmo.log.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-12-13 22:44:56 +01:00
Peter John Hartman
5181a5125f networkmonitor: fix to detect state changes
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>
2021-12-09 22:37:14 +01:00
Stacy Harper
b0f0e1cb03 Move some software stop in the sxmo scope
Some soft are handled by sxmo itself (and not by the user). Some stop
should then occurs from inside sxmo.

We also add some stop as notification monitor, etc.
2021-12-07 17:40:52 +01:00
Maarten van Gompel
88f09ee20d retain previous dwm/sway log prior to overwriting
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-12-06 00:38:13 -05:00
Stacy Harper
c446e9f23e Refactorise to simplify wm detection
We dont use guesswm and rely on a SXMO_WM env variable. We now use
guesswm for non wm action (from ssh, console, rtc wakes, etc). It will
try to setup needed variables.

This way, we avoid to run sxmo_wm.sh and to check variables everytime.

This allow the user to manage sxmo_screenlock.sh from ssh and to run a
desktop software with "sxmo_wm.sh exec foot" by example.

We remove the "ssh" wm cause it does not really make sense anyway.

The sxmo_rtcwake.sh dont try to setup variables anymore cause the user
must use "sxmo_wm.sh exec" if they want to start a destkop software
anyway.

We remove the "xorg" check everywhere cause that make no sense. We
keep the xorg prefixed methods for common xorgs cases.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-11-23 15:26:35 -05:00
Stacy Harper
f5662dabb0 Force wayland video driver on sdl 2021-11-11 15:06:23 +01:00
Stacy Harper
2a823c88d5 Move some bemenu arg to env variable
This also add the -M and -H new bemenu args

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Anjandev Momi <anjan@momi.ca>
2021-11-08 12:10:16 -05:00
Stacy Harper
0021b54119 Drop almost useless mpv config
We dont need those config and this prevent the user mpv config to take
priority by default.

We just drop this completly.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-22 18:57:51 +02:00
Maarten van Gompel
840caa75a2 renamed new hooks: start, stop (instead of wm_start, wm_shutdown) 2021-10-10 15:09:07 +02:00
Stacy Harper
f5d8559ead Add two wm hooks to start and stop user services
We remove the audiostart hook to add two consistent wm hooks to start
and stop user services and handle initial configs.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-10-10 15:08:44 +02:00
Maarten van Gompel
d5139e4393 increased default font size for bemenu
Signed-off-by: Stacy Harper <contact@stacyharper.net>
2021-08-27 07:37:41 +02:00
Stacy Harper
c014c6bb92 Load user .profile after setting up default values
This allow the user .profile to switch case depending on the default
values. It is mandatory by example to setup custom wvkbd or svkbd,
depending on the wm we use.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
2021-08-26 12:38:53 +02:00
Stacy Harper
5a769d3fa8 Fix swmo shellcheck issues 2021-08-22 14:17:47 +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