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
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() {
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 !