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 = {
|
||||
Type = "oneshot";
|
||||
User = "fred";
|
||||
Environment = "XDG_RUNTIME_DIR=/run/user/%U";
|
||||
ExecStart = "${pkgs.quickshell}/bin/qs ipc call lock lock";
|
||||
ExecStartPost = "${pkgs.coreutils}/bin/sleep 1";
|
||||
# XDG_RUNTIME_DIR must be derived at runtime: the %U specifier is the
|
||||
# UID of the *manager* running the unit (0 for system units), not the
|
||||
# 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";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue