35 lines
990 B
Nix
35 lines
990 B
Nix
{ pkgs, config, ... }:
|
|
{
|
|
home.packages = with pkgs; [
|
|
(pkgs.writeScriptBin "grimedit" ''
|
|
# Freeze the screen using hyprpicker
|
|
${pkgs.hyprpicker}/bin/hyprpicker -r -z &
|
|
HYPRPICKER_PID=$!
|
|
sleep 0.1
|
|
|
|
# Select area
|
|
GEOM=$(${pkgs.slurp}/bin/slurp -w 3 -c ${config.look.colors.prime} -B 00000066 -b 00000099)
|
|
|
|
# Check selection is canceled
|
|
if [ -z "$GEOM" ]; then
|
|
kill $HYPRPICKER_PID 2>/dev/null
|
|
notify-send -t 3000 -a grimblast "Error" "No area selected."
|
|
exit 1
|
|
fi
|
|
|
|
# Define screenshot destination
|
|
FILE="''${XDG_PICTURES_DIR:-$HOME/Pictures}/Screenshots/$(date -Ins).png"
|
|
|
|
# Save and edit screenshot
|
|
grim -g "$GEOM" "$FILE"
|
|
swappy -f $FILE &
|
|
|
|
# Notify user that the screenshot is saved
|
|
notify-send -a grim "Screenshot" "Area saved to $FILE" -i "$FILE"
|
|
|
|
# Kill picker after selection
|
|
kill %1 2>/dev/null
|
|
'')
|
|
];
|
|
}
|