From 72a2c77772f1d20622a18f8b1a64d7161c28bb73 Mon Sep 17 00:00:00 2001 From: Gliczy <129636582+Gliczy@users.noreply.github.com> Date: Sun, 14 Jun 2026 04:11:53 +0200 Subject: [PATCH] makeAutostartItem: only use sed on `Exec` key Fix cases when using `makeStartupItem` and it's `prependExtraArgs` or `appendExtraArgs` option with a desktop file having a `TryExec` key. The `TryExec` key must either be an absolute path to the binary or the binary name (if present in $PATH). When using either of the two options above, the `TryExec` key will be modified to have the flags as it's content, which is invalid and will break the desktop file. The change to the sed command makes it so only lines starting with `Exec` are changed, ignoring `TryExec` and preventing the issue from happening. Link to the FDO specification: https://specifications.freedesktop.org/desktop-entry/latest/recognized-keys.html --- pkgs/build-support/make-startupitem/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/make-startupitem/default.nix b/pkgs/build-support/make-startupitem/default.nix index 03677355b8d6..b1294a43a0f8 100644 --- a/pkgs/build-support/make-startupitem/default.nix +++ b/pkgs/build-support/make-startupitem/default.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation { target=${name}.desktop cp ${package}/share/applications/${srcPrefix}${name}.desktop $target ${lib.optionalString (prependExtraArgs != [ ] || appendExtraArgs != [ ]) '' - sed -i -r "s/(Exec=)([^ \n]*) *(.*)/\1\2 ${prependArgs}\3${appendArgs}/" $target + sed -i -r "s/^(Exec=)([^ \n]*) *(.*)/\1\2 ${prependArgs}\3${appendArgs}/" $target ''} chmod +rw $target echo "X-KDE-autostart-phase=${phase}" >> $target