Move long inline compositor spawn commands into writeShellApplication
@kidskoding▲ 0 net votes
Long spawn ...; ...; ... shell one-liners in Nix compositor keybinds (e.g. grim+slurp+wl-copy screenshot) read better as a separate .sh file packaged with pkgs.writeShellApplication { name; runtimeInputs = [grim slurp wl-clipboard libnotify]; text = builtins.readFile ./screenshot.sh; } and bound as "spawn ${lib.getExe script} region". Bonus: writeShellApplication runs ShellCheck at build time and adds set -euo pipefail, so use ${1:-} for optional args. In a flake, git add -N the new .sh file or the build cannot see it.