From ffd48fa9eaf09d0b3aeca4828d86040bd2f4f0b1 Mon Sep 17 00:00:00 2001 From: Riley Apeldoorn Date: Mon, 5 Sep 2022 10:05:34 +0200 Subject: [PATCH] Add `sc` script --- scripts/README.md | 7 ++++--- scripts/sc.nix | 12 ++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 scripts/sc.nix diff --git a/scripts/README.md b/scripts/README.md index 12dd747..e4c92a4 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -3,6 +3,7 @@ This directory contains nix derivations for shell scripts I want to use across devices. -| Filename | Scripts | Description | -| ---------- | -------- | --------------------------- | -| `clip.nix` | `c`, `p` | Copy and paste abstractions | +| Filename | Scripts | Description | +| ---------- | -------- | ------------------------------------------ | +| `clip.nix` | `c`, `p` | Copy and paste abstractions | +| `sc.nix` | `sc` | Area screenshot tool with clip integration | diff --git a/scripts/sc.nix b/scripts/sc.nix new file mode 100644 index 0000000..99a00b9 --- /dev/null +++ b/scripts/sc.nix @@ -0,0 +1,12 @@ +{ pkgs, ... }: with pkgs; { + + # Take a screenshot of a selected area and put it in the clipboard. + sc = (writeShellApplication { + name = "sc"; + runtimeInputs = [ xclip scrot ]; + text = '' + scrot -z -s - | tee /tmp/sc.png | xclip -i -sel clip -t image/png + ''; + }); + +}