Files
nixos/apps/screenshot/default.nix
T
2026-01-02 00:27:59 -06:00

46 lines
1.3 KiB
Nix

{pkgs, ...}: let
# Screenshot script with swappy integration
screenshot = pkgs.writeShellScriptBin "screenshot" ''
#!/usr/bin/env bash
case "$1" in
region)
# Select region and edit
grim -g "$(slurp)" - | swappy -f -
;;
window)
# Screenshot active window
grim -g "$(hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"')" - | swappy -f -
;;
screen)
# Screenshot current monitor
grim -o "$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')" - | swappy -f -
;;
all)
# Screenshot all monitors
grim - | swappy -f -
;;
region-save)
# Quick region screenshot (save without editing)
grim -g "$(slurp)" ~/Pictures/Screenshots/$(date +'%Y-%m-%d_%H-%M-%S.png')
notify-send "Screenshot saved" "Saved to ~/Pictures/Screenshots/"
;;
*)
echo "Usage: screenshot {region|window|screen|all|region-save}"
exit 1
;;
esac
'';
in {
home.packages = with pkgs; [
grim # Screenshot utility
slurp # Region selector
swappy # Annotation tool
jq # For window selection
screenshot # Our wrapper script
];
# Create Screenshots directory
home.file."Pictures/Screenshots/.keep".text = "";
}