~mil/sxmo-devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
4 3

[PATCH sxmo-utils] Don't start a dbus session if one is already running

Details
Message ID
<20220326143201.1421118-1-aren@peacevolution.org>
DKIM signature
pass
Download raw message
Patch: +23 -11
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.

An alternative method of implementing this would be to inform systemd of
the of the bus we start, but I don't see why we would want to run extra
bus sessions.
---
 scripts/core/sxmo_winit.sh | 16 +++++++++++-----
 scripts/core/sxmo_xinit.sh | 18 ++++++++++++------
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/scripts/core/sxmo_winit.sh b/scripts/core/sxmo_winit.sh
index 6765cb0..1f3c836 100644
--- a/scripts/core/sxmo_winit.sh
+++ b/scripts/core/sxmo_winit.sh
@@ -20,12 +20,18 @@ defaults() {
	[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
}

with_dbus() {
	echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
	exec /usr/bin/sway -c "$XDG_CONFIG_HOME/sxmo/sway"
}

start() {
	# shellcheck disable=SC2016
	dbus-run-session sh -c '
		echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
		/usr/bin/sway -c "$XDG_CONFIG_HOME/sxmo/sway"
	'
	if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
		exec dbus-run-session -- "$0" "with_dbus"
	else
		# This needs to be run in a subshell
		( with_dbus )
	fi
}

cleanup() {
diff --git a/scripts/core/sxmo_xinit.sh b/scripts/core/sxmo_xinit.sh
index 17683b3..2398b4b 100755
--- a/scripts/core/sxmo_xinit.sh
+++ b/scripts/core/sxmo_xinit.sh
@@ -40,14 +40,20 @@ defaultkeyboard() {
	fi
}

with_dbus() {
	echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
	# shellcheck source=configs/appcfg/xinit_template
	. "$XDG_CONFIG_HOME"/sxmo/xinit
	exec dwm
}

start() {
	# shellcheck disable=SC2016
	dbus-run-session sh -c '
		echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
		. "$XDG_CONFIG_HOME"/sxmo/xinit
		dwm
	'
	if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
		exec dbus-run-session -- "$0" "with_dbus"
	else
		# This needs to be run in a subshell
		( with_dbus )
	fi
}

cleanup() {
-- 
2.35.1

[sxmo-utils/patches/.build.yml] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CITVF2Z6YBSU.HC15R6FKNAXP@cirno>
In-Reply-To
<20220326143201.1421118-1-aren@peacevolution.org> (view parent)
DKIM signature
missing
Download raw message
sxmo-utils/patches/.build.yml: SUCCESS in 25s

[Don't start a dbus session if one is already running][0] from [ArenM][1]

[0]: https://lists.sr.ht/~mil/sxmo-devel/patches/30578
[1]: aren@peacevolution.org

✓ #723491 SUCCESS sxmo-utils/patches/.build.yml https://builds.sr.ht/~mil/job/723491
Details
Message ID
<31YRR9K9CZC8B.30G6LIVBX1GZH@stacyharper.net>
In-Reply-To
<20220326143201.1421118-1-aren@peacevolution.org> (view parent)
DKIM signature
pass
Download raw message
> ---
>  scripts/core/sxmo_winit.sh | 16 +++++++++++-----
>  scripts/core/sxmo_xinit.sh | 18 ++++++++++++------
>  2 files changed, 23 insertions(+), 11 deletions(-)
> 
> diff --git a/scripts/core/sxmo_winit.sh b/scripts/core/sxmo_winit.sh
> index 6765cb0..1f3c836 100644
> --- a/scripts/core/sxmo_winit.sh
> +++ b/scripts/core/sxmo_winit.sh
> @@ -20,12 +20,18 @@ defaults() {
>  	[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
>  }
>  
> +with_dbus() {
> +	echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
> +	exec /usr/bin/sway -c "$XDG_CONFIG_HOME/sxmo/sway"

Why to you exec here ?

> +}
> +
>  start() {
> -	# shellcheck disable=SC2016
> -	dbus-run-session sh -c '
> -		echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
> -		/usr/bin/sway -c "$XDG_CONFIG_HOME/sxmo/sway"
> -	'
> +	if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
> +		exec dbus-run-session -- "$0" "with_dbus"
> +	else
> +		# This needs to be run in a subshell
> +		( with_dbus )

Caused by your exec I dont understand yet I guess

> +	fi
>  }
>  
>  cleanup() {
Details
Message ID
<20220403174645.aq3z3rgxhd5aqwsj@xeez>
In-Reply-To
<31YRR9K9CZC8B.30G6LIVBX1GZH@stacyharper.net> (view parent)
DKIM signature
pass
Download raw message
Thanks for taking a look at this!

> > ---
> >  scripts/core/sxmo_winit.sh | 16 +++++++++++-----
> >  scripts/core/sxmo_xinit.sh | 18 ++++++++++++------
> >  2 files changed, 23 insertions(+), 11 deletions(-)
> >
> > diff --git a/scripts/core/sxmo_winit.sh b/scripts/core/sxmo_winit.sh
> > index 6765cb0..1f3c836 100644
> > --- a/scripts/core/sxmo_winit.sh
> > +++ b/scripts/core/sxmo_winit.sh
> > @@ -20,12 +20,18 @@ defaults() {
> >  	[ -e "$HOME"/.Xresources ] && xrdb -merge "$HOME"/.Xresources
> >  }
> >
> > +with_dbus() {
> > +	echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
> > +	exec /usr/bin/sway -c "$XDG_CONFIG_HOME/sxmo/sway"
>
> Why to you exec here ?

When this gets called through dbus-run-session, the second copy of the
script will keep running after we spawn sway. I used exec to avoid that
happening, since it's unnecessary.

> > +}
> > +
> >  start() {
> > -	# shellcheck disable=SC2016
> > -	dbus-run-session sh -c '
> > -		echo "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR"/dbus.bus
> > -		/usr/bin/sway -c "$XDG_CONFIG_HOME/sxmo/sway"
> > -	'
> > +	if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
> > +		exec dbus-run-session -- "$0" "with_dbus"
> > +	else
> > +		# This needs to be run in a subshell
> > +		( with_dbus )
>
> Caused by your exec I dont understand yet I guess

Yes it's caused by the exec, I should probably have made that more clear
in the comment.

> > +	fi
> >  }
> >
> >  cleanup() {
Details
Message ID
<3MYX2CKY35K60.3NJTP0AAEW0CJ@stacyharper.net>
In-Reply-To
<20220326143201.1421118-1-aren@peacevolution.org> (view parent)
DKIM signature
pass
Download raw message
I'm sorry it just doesnt work at all. This version break the cleanup
logic. It also break the ssh connection that grab sxmo environment
variable logic. I dont have time to cleanup and find a good solution to
support this.

I mark this as need revisions !
Reply to thread Export thread (mbox)