greenhouse

kore

my public infrastructure monorepo

git clone [email protected]:kore.git

kore / home / features / wayland / dwl.nix22 lines · 692B · raw

1{ config, pkgs, ... }:
2
3let
4  screenshot = pkgs.writeShellApplication {
5    name = "screenshot";
6    runtimeInputs = with pkgs; [ grim slurp wl-clipboard coreutils ];
7    text = ''
8      case "''${1:-area}" in
9        area) grim -g "$(slurp)" - | wl-copy -t image/png ;;
10        output) grim -g "$(slurp -o)" - | wl-copy -t image/png ;;
11        save)
12          dir="${config.xdg.userDirs.pictures}/screenshots"
13          mkdir -p "$dir"
14          grim -g "$(slurp)" "$dir/$(date +%Y-%m-%d_%H-%M-%S).png"
15          ;;
16        *) echo "usage: screenshot [area|output|save]" >&2; exit 1 ;;
17      esac
18    '';
19  };
20in {
21  home.packages = with pkgs; [ wmenu wl-clipboard xdg-utils screenshot ];
22}