-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include a systemd.service file #5160
Comments
I personally wouldn't be against having it in |
NACK, because people are going to use it anyway and are inevitably going to file bugs which are caused by it. This already happens. Not going to block this if I'm outnumbered, though. |
TBH, I'm not sure what to do about bugs for |
It's hard to think of bugs that would come up exclusively due to running as a systemd service. Bug report rules could include "try running this without systemd before reporting bug" though, just to rule those out. I also don't mind being tagged in bugs that are a direct result of this, I've been messing around with systemd user services for years. |
Using systemd user services like this introduces quite a few areas of surprise. Just looking at the referenced service file, this will not yield stable results if depended upon. Dependent services will launch immediately after systemd forks off sway, and will race with sway initialization and your config posting A solution to utilizing user services that I personally find to be more correct would just be a |
Trying to start Wayland compositors from systemd services come with all sorts of weirdness and potential session management issues, and no solution I've ever seen really is truly portable/general for everybody. I don't think this is something I want upstream. I basically agree with what @kennylevinsen said. For starting Wayland compositors automatically, I think an extremely basic display manager (even if it has no GUI and just launches it unconditionally) would work better. systemd/logind is much more geared to handling display managers. |
You're very right. I'd never though of this, but you're very right. 😞
I wonder if such a target file could be included with systemd though. Again, just to standardise what target other software will rely on. Again, I just find it annoying that every user has to copy-paste files from different source to get things up and running, and since everyone makes it slightly different, the heterogeneity in setups makes all forms of support and sharing so hard. As an alternative, sway could use
I've read a lot about display managers, but I can't figure out what they bring to the table. If one has multiple DEs, they offer a list to pick one, but if I just use |
-1, logind is unrelated to running Sway as a systemd service. |
I meant to say that this would not introduce a new dependency. |
IIRC there is a command (aka binary) to notify readiness. This could live at the end of the sway config. |
Login managers are just the unit that opens a PAM session, setuid's to the target user and launches your application of choice—any interactive multi-user machine will have one. If you log into a console, it's usually You don't need the complexity of GDM to do that. You have options like ly, or, to make a shameless plug, greetd.
-1, this can be done by those wanting it in the config file. It's already troublesome that sway has to know about logind. I don't see there being an issue where people has to "copy-paste files from different sources". Sway starts and works OOTB, and getting additional services started in tandem is very easy—much easier than through user services. Non-bug support problems are usually related to things like not having the default terminal, trying weird custom configurations, or the occasional individual troubled by trying to run sway itself as a user service. :) |
Unrelated, Should |
@travankor It's a bit off-topic here—the mailing list and support channel are the appropriate places to go. Quick answers: greetd, gtkgreet and wlgreet are packaged in AUR, greetd and gtkgreet is tagged, wlgreet is seeing new interest, dlm is mostly just a PoC. The idea is that it's simple to make greeters, so maybe others' will show up. |
btw, which sway problems do you want to solve with systemd? |
I personally want to see Sway logs in |
|
@ikalnytskyi I haven't tried personally but maybe something like this would work?
|
For simplicity's sake, I just run sway as a I also run all my other background services this way (fcitx, waybar, deluged, etc). I'm gotten used to having a service manager to start/stop/monitor these services rather than have them all just run loose. I guess running sway the same way is also a habit since that's how I'd run i3 too. |
This works like a charm:
|
I've been thinking about it, and running In sway's case, restarting it does not makes sense; that kills everything. That's analogous to restarting Xorg, not just i3. And I already have a hotkey to reload sway in-place anyway. I therefore think it doesn't make as much sense to run sway as a systemd service. I guess it's hard to fully understand when migrating from Xorg+i3. Intuitively, one want to change the overall setup as least as possible, but that's not necessarily a good idea here. I therefore don't think including the service file makes sense any more, and am inclined to close this request. I will try to reflect these thoughts on the wiki though; others have supported this request, and maybe the same insight is useful to them...? That aside, I do think sway should include a This would also allow tools like Edit: Yes, |
Maybe I'm completely out of band (and terribly missed something). I'm attempting to bring some order into my environment setup which occasionally brakes all the time. Therefore, I figured, Now there is But based on #3109 (comment)
I figured, enabled by Any insight? Is |
I recommend against usage of such pointless "environment loading" mechanisms (e.g. pam_env, environment.d, ...). They are unnecessary, complex, inflexible, and attempting to use them usually brings nothing but pain. Usage of a wrapper script (e.g. "sway-run"), or even .profile, is a much cleaner and ultimately superior solution to any "environment loader". The wrapper script approach:
Can't really beat that. |
Thanks @kennylevinsen ! This is what I finally ended up with in #!/bin/bash
...
# Environment
while read -r l; do
eval export $l
done < <(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
... Would I be encouraged to put this in the wiki section?
For avoidance of doubt, I still use the other recommended parts for # Session
export XDG_SESSION_TYPE=wayland
export XDG_SESSION_DESKTOP=sway
export XDG_CURRENT_DESKTOP=sway
source /usr/local/bin/wayland_enablement.sh PS: If I'd had used |
That is not entirely true, GDM for example requests the current environment from the systemd user daemon at login and uses that as a clean (it does not pass along environment variables it itself has been started with) environment for the launched session. Well, except for PATH, which I've filed a bug about, but there is some friction to get that solved.
I would say that this is subjective. pam_env certainly has the problem of evaluating user-generated files as root, but environment.d (or the other environment generators for that matter) explicitly has not. It is also not unnecessary (in general), as this presents an unified way to set environment variables for user services and the session. It is certainly not more complex than shell scripts, and since generators can also be shell scripts it can not be less flexible than them either. I don't think that sway should include a service file right now, as the whole "run your session as user services" thing is still quite new and there needs some standardization (for target names and such) before anyone should ship official services (and I know that sway never will, but still). But, running a sway session with the environment from environment.d is certainly possible, with or without having sway itself be a user serivce. |
I don't think this issue is the correct forum to continue environment loading discussions. The issue was only about inclusion of a systemd user service in the repo. If people want to bend over backwards to use an environment loader that (as per its own man page) is only meant for systemd user services, they can of course do that, but they'll be on their own. Systemd user services being young has nothing to do with them being poorly suited for the task. GDM's use of a wrapper around your session to load environment (again bending over backwards to load due to GNOME being infatuated with user services to the point of abusing the functionality) just cements wrappers as the correct way of inserting your environment. Making systemd parse your file, import it, have you request it over dbus, and then you reparse it to be setenv compatible is just a waste of time if you're already have a wrapper script that does not need any of those steps. This is especially true if you want user services in a graphical environment, as that requires you to overwrite the systemd user environment anyway, making the entire exercise for naught. |
You are right about that, but since the last posts in this issue kind of convey the incorrect message that using the systemd environment is not possible, or not intended from the systemd side (I am fully aware that for the sway project this is not the intended usage), I wanted to correct that (as I am using sway in the exact way which was said to be not possible). It looks like my version of the manpage is different from yours, but don't take it from me, the official systemd documentation mentions running applications as services. Now obviously this is not supported or encouraged by the sway project in any way, and I am not here to discuss that. I just want to state that, inofficially, this is possible, and while the sway project does not support this approach, the systemd project has no qualms with it (as of now at least). |
You completely misread. I said that environment.d(5) is only for services started by the systemd user instance (see here and here - apologies for XML, but that's systemd manpage sources). I did not say that you cannot run arbitrary applications as user services - you definitely can (except for the session-leader process). I have, however, explained why I find systemd user services to be unsuitable for starting a user shell (e.g. sway), and that I find the use systemd user services just to read environment.d to be a bit of a pointless exercise. Same with using "show-environment" to extract the systemd environment. I'm happy to entertain further arbitrary discussions on IRC, but unless there is something to add about sway, there is no need to spam this issue any further. |
I'll take the liberty and drag my "solution" to the wiki pages. |
Related i3 discussion: i3/i3#5186 |
I'm wondering if it would be possible to include a systemd.service(5) file with sway.
The wiki gives clear instructions on how to copy-paste one to run sway as a systemd service, but including one with sway itself might make this more "standard", facilitating setup for many users (and making setups a bit more homogeneous, except for those that actually want to tinker extra).
Installing something like this into
/usr/lib/systemd/user/sway.service
should do:Also, for apps that rely on sway, it makes providing their own systemd service file easier, since they'd have an explicit service to rely on.
The text was updated successfully, but these errors were encountered: