Last active
January 4, 2022 04:53
-
-
Save tomty89/4bac7bd1a4c85d59274da8281160361c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ -z "$XDG_VTNR" ] || [ -z "$XDG_SESSION_ID" ]; then | |
exit 1 | |
fi | |
exec systemd-run --user -u sway-"$XDG_VTNR" -E XDG_SESSION_ID="$XDG_SESSION_ID" -G -t bash -lc sway |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
libseat gets the "graphical" (as in, the existing earliest session, apparently; it's marked with an
*
inloginctl user-status
) session via libsystemd. If the tty of that session is being used (e.g. by X, or another sway instance / wayland compositor, probably), the approach will lead to failure, in which caseXDG_SESSION_ID
can be used to specify a different session (which "owns" a tty) to use.Since sway is intended to be run by the user manager (e.g. so that it will be attached to the user manager's netns),
--scope
is avoided.bash -lc
provides the "profile" env vars.-t
is for showing the (error) messages directly on the console. It's especially convenient when-G
is needed/used.