Open pacien opened 1 year ago
A simple workaround is to let the window manager start Waybar itself instead of using systemd.
For example, with Sway:
wayland.windowManager.sway.config = {
- bars = [ ]; # disable swaybar
+ bars = [{ command = "waybar"; }];
};
programs.waybar = {
enable = true;
- systemd = {
- enable = true;
- target = "sway-session.target";
- };
Hi @pacien,
NixOS has a "nasty" behavior and starts the graphical-session.target
before launching the DM.
This works alright when using X11, where the DISPLAY
doesn't change, but leads to services that randomly fail to start under Wayland.
I personally used a patch to nixpkgs to disable this behavior. I don't use Linux/Sway at all these days so I won't upstream my changes.
You can have a look here:
https://github.com/berbiche/dotfiles/commit/0d8a727df01b8b28f96f2ad57e06ac0e3dc8f217
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Still happening for me. Any chance we can fix this in the home-manager module?
An (untested) alternative may be to do something like
diff --git a/modules/programs/waybar.nix b/modules/programs/waybar.nix
index efc34a30..ef2827fa 100644
--- a/modules/programs/waybar.nix
+++ b/modules/programs/waybar.nix
@@ -308,8 +308,8 @@ in {
Description =
"Highly customizable Wayland bar for Sway and Wlroots based compositors.";
Documentation = "https://github.com/Alexays/Waybar/wiki";
- PartOf = [ "graphical-session.target" ];
- After = [ "graphical-session.target" ];
+ PartOf = [ "tray.target" ];
+ ConditionEnvironment = "WAYLAND_DISPLAY";
};
Service = {
@@ -319,7 +319,7 @@ in {
KillMode = "mixed";
};
- Install = { WantedBy = [ cfg.systemd.target ]; };
+ Install.WantedBy = [ "tray.target" ];
};
})
]);
diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix
index 9031a0a7..ee0e9d75 100644
--- a/modules/services/window-managers/i3-sway/sway.nix
+++ b/modules/services/window-managers/i3-sway/sway.nix
@@ -481,7 +481,7 @@ in {
Unit = {
Description = "sway compositor session";
Documentation = [ "man:systemd.special(7)" ];
- BindsTo = [ "graphical-session.target" ];
+ BindsTo = [ "graphical-session.target" "tray.target" ];
Wants = [ "graphical-session-pre.target" ]
++ optional cfg.systemd.xdgAutostart "xdg-desktop-autostart.target";
After = [ "graphical-session-pre.target" ];
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Not stale. Something along the lines of the proposed systemd changes should be implemented as Waybar has a tray module.
I also have the same issue.
I also have this issue. I cannot logout and relogin without half of may services broken.
Thank you for your contribution! I marked this issue as stale due to inactivity. Please be considerate of people watching this issue and receiving notifications before commenting 'I have this issue too'. We welcome additional information that will help resolve this issue. Please read the relevant sections below before commenting.
* If this is resolved, please consider closing it so that the maintainers know not to focus on this. * If this might still be an issue, but you are not interested in promoting its resolution, please consider closing it while encouraging others to take over and reopen an issue if they care enough. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
* If you are also experiencing this issue, please add details of your situation to help with the debugging process. * If you know how to solve the issue, please consider submitting a Pull Request that addresses this issue.
Don't be afraid to manually close an issue, even if it holds valuable information. Closed issues stay in the system for people to search, read, cross-reference, or even reopen – nothing is lost! Closing obsolete issues is an important way to help maintainers focus their time and effort.
Starting Waybar at login with systemd is flaky
Sometimes it starts fine, sometimes it starts but without being able to communicate with Sway, sometimes it doesn't manage to start at all (maxing out the restart counter).
Relevant config keys, logging in with
greetd
:Partial start failure:
Full start failure:
Versions:
CC maintainers: @berbiche