lock-before-sleep: derive XDG_RUNTIME_DIR at runtime, %U was root
This commit is contained in:
parent
9514664a55
commit
52599fd24d
1 changed files with 10 additions and 5 deletions
|
|
@ -78,9 +78,14 @@ in
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
User = "fred";
|
User = "fred";
|
||||||
Environment = "XDG_RUNTIME_DIR=/run/user/%U";
|
# XDG_RUNTIME_DIR must be derived at runtime: the %U specifier is the
|
||||||
ExecStart = "${pkgs.quickshell}/bin/qs ipc call lock lock";
|
# UID of the *manager* running the unit (0 for system units), not the
|
||||||
ExecStartPost = "${pkgs.coreutils}/bin/sleep 1";
|
# one in User=, so it pointed qs at /run/user/0.
|
||||||
|
ExecStart = pkgs.writeShellScript "lock-before-sleep" ''
|
||||||
|
export XDG_RUNTIME_DIR=/run/user/$(${pkgs.coreutils}/bin/id -u)
|
||||||
|
${pkgs.quickshell}/bin/qs ipc call lock lock
|
||||||
|
${pkgs.coreutils}/bin/sleep 1
|
||||||
|
'';
|
||||||
TimeoutStartSec = "5s";
|
TimeoutStartSec = "5s";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue