-
-
Notifications
You must be signed in to change notification settings - Fork 15.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
nixos/hypridle: only run the service on Hyprland #355416
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -10,17 +10,31 @@ let | |||||||||||||||||||
in | ||||||||||||||||||||
{ | ||||||||||||||||||||
options.services.hypridle = { | ||||||||||||||||||||
enable = lib.mkEnableOption "hypridle, Hyprland's idle daemon"; | ||||||||||||||||||||
enable = lib.mkEnableOption null // { | ||||||||||||||||||||
description = '' | ||||||||||||||||||||
Whether to enable Hypridle, Hyprland's idle daemon. | ||||||||||||||||||||
|
||||||||||||||||||||
::: {.note} | ||||||||||||||||||||
For this service to work properly on Hyprland, you | ||||||||||||||||||||
need to have `programs.hyprland.withUWSM` enabled. | ||||||||||||||||||||
::: | ||||||||||||||||||||
''; | ||||||||||||||||||||
}; | ||||||||||||||||||||
package = lib.mkPackageOption pkgs "hypridle" { }; | ||||||||||||||||||||
}; | ||||||||||||||||||||
|
||||||||||||||||||||
config = lib.mkIf cfg.enable { | ||||||||||||||||||||
environment.systemPackages = [ cfg.package ]; | ||||||||||||||||||||
|
||||||||||||||||||||
systemd = { | ||||||||||||||||||||
packages = [ cfg.package ]; | ||||||||||||||||||||
user.services.hypridle.wantedBy = [ "graphical-session.target" ]; | ||||||||||||||||||||
user.services.hypridle.path = [ | ||||||||||||||||||||
systemd.packages = [ cfg.package ]; | ||||||||||||||||||||
|
||||||||||||||||||||
systemd.user.services.hypridle = { | ||||||||||||||||||||
# Service should be only be started on Hyprland | ||||||||||||||||||||
# this target is started by UWSM | ||||||||||||||||||||
wantedBy = [ "[email protected]" ]; | ||||||||||||||||||||
Comment on lines
+32
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will only start the service. It will not wait for to have started and never stop it either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These two targets do not exist on NixOS. We've explicitly limited this module to only work with the We also want to order hypridle There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. edited There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In my config I made it I do find it a bit weird to depend on the session target rather than the wm service though as that's our actual dependency. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Units of service and target are bound, so there is no difference for dependencies. Targets are more frequently used as dependencies.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't follow. Could you reword? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Targets are more frequently used for dependencies than services. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Depending on When a WM managed by UWSM is terminated, graphical-session also stops. So I understand the partOf bit. What I don't understand is why are we supposed to start it "before"
Agreed. EDIT: I did read the above discussion about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because we only want the session to be considered up and running once hypridle is up and running. |
||||||||||||||||||||
|
||||||||||||||||||||
# Essential package needed for the service to run properly | ||||||||||||||||||||
path = [ | ||||||||||||||||||||
config.programs.hyprland.package | ||||||||||||||||||||
config.programs.hyprlock.package | ||||||||||||||||||||
pkgs.procps | ||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should assert that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because @fufexan wants it to be compatible with other compositors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As it stands right now, it cannot be compatible with other compositors because it depends on the hyprland-uwsm-specific units.
If you wanted to use it with another compositor, you should bring your own hypridle unit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be compatible if you just add more targets in
WantedBy
andAfter
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or simply add
systemd.user.services.swayidle.wantedBy = ["your-compositors-session.target"];
. This should be an admonition in the enable option's description.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could turn the targets that hypridle is
wantedBy
andbefore
into an option.withUWSM
would set it to the UWSM-generated session unit. We could then simply assert that this option's value isn't an empty list.