diff --git a/configs/nixos/modules/desktop/utilities/screenshot.nix b/configs/nixos/modules/desktop/utilities/screenshot.nix index ff33392..e3630c8 100644 --- a/configs/nixos/modules/desktop/utilities/screenshot.nix +++ b/configs/nixos/modules/desktop/utilities/screenshot.nix @@ -4,25 +4,27 @@ pkgs, ... }: -# Keyboard-driven screenshots that open in satty for annotation, then land in -# both the clipboard and a dated file. +# Keyboard-driven screenshots copy to the clipboard before Satty opens for +# annotation. Satty copies annotated screenshots when it saves them. let cfg = config.modules.desktop.utilities.screenshot; # NOLINT(let_order) user = config.user.name; grimblast = "${pkgs.grimblast}/bin/grimblast"; satty = "${pkgs.satty}/bin/satty"; + tee = "${pkgs.coreutils}/bin/tee"; wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy"; xdgUserDir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir"; - # satty's copy action also saves, so one keystroke lands the shot in both the - # clipboard and a file. + # Copy the original screenshot before Satty opens. + # Satty copies and saves annotated screenshots when the user presses Enter. capture = target: pkgs.writeShellScript "screenshot-${target}" '' dir="$(${xdgUserDir} PICTURES)/Screenshots" mkdir -p "$dir" ${grimblast} save ${target} - \ + | ${tee} >(${wl-copy}) \ | ${satty} --filename - \ --output-filename "$dir/screenshot-%Y%m%d-%H%M%S.png" \ --copy-command ${wl-copy} \