mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 14:50:40 +02:00
feat: add editing capability to screenshot tool
This commit is contained in:
parent
cf56c2ea31
commit
c6dca8e82d
1 changed files with 20 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
writeShellApplication,
|
||||
grimblast,
|
||||
libnotify,
|
||||
satty,
|
||||
tesseract,
|
||||
wl-clipboard,
|
||||
}:
|
||||
|
@ -10,6 +11,7 @@ writeShellApplication {
|
|||
runtimeInputs = [
|
||||
grimblast
|
||||
libnotify
|
||||
satty
|
||||
tesseract
|
||||
wl-clipboard
|
||||
];
|
||||
|
@ -17,7 +19,8 @@ writeShellApplication {
|
|||
umask 077
|
||||
|
||||
date=$(date +"%Y-%m-%dT%H:%M:%S%:z")
|
||||
out="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-selection.png"
|
||||
out_base="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-selection"
|
||||
out="$out_base.png"
|
||||
mkdir -p "$(dirname "$out")"
|
||||
|
||||
grimblast --freeze save area "$out" || exit 2
|
||||
|
@ -54,12 +57,14 @@ writeShellApplication {
|
|||
unset __notify_output
|
||||
}
|
||||
|
||||
edit_counter=1
|
||||
title="📷 Screenshot captured"
|
||||
body="📋 image copied to clipboard"
|
||||
while true; do
|
||||
action=$(notify_wait_action main "$title" "$body" \
|
||||
--action=ocr="Run OCR" \
|
||||
--action=copy="Copy Image")
|
||||
--action=ocr="🔠 Run OCR" \
|
||||
--action=edit="✏️ Edit" \
|
||||
--action=copy="📋 Copy Image")
|
||||
|
||||
case "$action" in
|
||||
ocr)
|
||||
|
@ -72,6 +77,18 @@ writeShellApplication {
|
|||
fi
|
||||
;;
|
||||
|
||||
edit)
|
||||
satty --filename "$out" \
|
||||
--output-filename "$out_base-edit-$edit_counter.png" \
|
||||
--copy-command wl-copy \
|
||||
--initial-tool brush \
|
||||
--save-after-copy \
|
||||
--fullscreen \
|
||||
--early-exit
|
||||
body="🎨 image edited"
|
||||
edit_counter=$((edit_counter + 1))
|
||||
;;
|
||||
|
||||
copy)
|
||||
wl-copy -t image/png < "$out"
|
||||
body="📋 image copied to clipboard"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue