Skip to content

Commit

Permalink
swayidle: use config.wayland.systemd.target
Browse files Browse the repository at this point in the history
Also add `Unit.After`.
  • Loading branch information
thiagokokada authored and rycee committed Jan 3, 2025
1 parent 0734cfa commit 89fe48b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions modules/services/swayidle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ in {

systemdTarget = mkOption {
type = types.str;
default = "graphical-session.target";
default = config.wayland.systemd.target;
defaultText = literalExpression "config.wayland.systemd.target";
example = "sway-session.target";
description = ''
Systemd target to bind to.
Expand All @@ -107,7 +108,8 @@ in {
Description = "Idle manager for Wayland";
Documentation = "man:swayidle(1)";
ConditionEnvironment = "WAYLAND_DISPLAY";
PartOf = [ "graphical-session.target" ];
PartOf = [ cfg.systemdTarget ];
After = [ cfg.systemdTarget ];
};

Service = {
Expand Down
3 changes: 2 additions & 1 deletion tests/modules/services/swayidle/basic-configuration.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ config, pkgs, lib, ... }:
{ config, ... }:

{
services.swayidle = {
Expand Down Expand Up @@ -50,6 +50,7 @@
Type=simple
[Unit]
After=graphical-session.target
ConditionEnvironment=WAYLAND_DISPLAY
Description=Idle manager for Wayland
Documentation=man:swayidle(1)
Expand Down

0 comments on commit 89fe48b

Please sign in to comment.