From d7ac88762db111a7962c4e14b5f4e37ab85ccac7 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sun, 24 Aug 2025 18:55:06 -0600 Subject: tree-wide: reformat using alejandra after enabling trivionomicon --- pkgs/scripts/clip.nix | 54 ++++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'pkgs/scripts/clip.nix') diff --git a/pkgs/scripts/clip.nix b/pkgs/scripts/clip.nix index b801ccf..3e16e3e 100644 --- a/pkgs/scripts/clip.nix +++ b/pkgs/scripts/clip.nix @@ -1,44 +1,50 @@ -{ lib -, writeShellScriptBin -, gnome-screenshot -, xclip -, file -, imagemagick -, toPDF -, ... +{ + lib, + writeShellScriptBin, + gnome-screenshot, + xclip, + file, + imagemagick, + toPDF, + ... }: with lib; let - name = if toPDF then "clip-pdf" else "clip"; + name = + if toPDF + then "clip-pdf" + else "clip"; pdfCmdline = optionalString toPDF '' if [ $# -lt 1 ]; then echo "Usage: $0 [opts...]" >&2 exit 1 fi - + OUT="$1" shift ''; copyOut = - if toPDF then '' + if toPDF + then '' ${imagemagick}/bin/convert "$CLIP" "$OUT" - '' else '' + '' + else '' ${xclip}/bin/xclip -selection clipboard \ -t $(${file}/bin/file -b --mime-type $CLIP) <"$CLIP" ''; in -writeShellScriptBin name '' - ${pdfCmdline} + writeShellScriptBin name '' + ${pdfCmdline} + + OPTIONS=-a + if [ "x$@" != "x" ]; then + OPTIONS="$@" + fi - OPTIONS=-a - if [ "x$@" != "x" ]; then - OPTIONS="$@" - fi - - CLIP="$HOME/vtmp/$$.png" - ${gnome-screenshot}/bin/gnome-screenshot "$OPTIONS" -f "$CLIP" - ${copyOut} + CLIP="$HOME/vtmp/$$.png" + ${gnome-screenshot}/bin/gnome-screenshot "$OPTIONS" -f "$CLIP" + ${copyOut} - rm "$CLIP" -'' + rm "$CLIP" + '' -- cgit v1.2.3