docs(hyprland, scripts): better screenshot script
This commit adds the possibility of using swappy to edit screenshots. It also changes the behaviour of the delay by first allowing the user to select the area they want to capture, and then only does it wait for the indicated amount of time before it takes the screen capture.
This commit is contained in:
parent
8ec4e4ad43
commit
f7b6ef1a4c
@ -421,12 +421,12 @@ what most of these do.
|
|||||||
Here are the keybinding for the screenshot submap
|
Here are the keybinding for the screenshot submap
|
||||||
#+name: screenshot-submap
|
#+name: screenshot-submap
|
||||||
| Modifiers | Key | Action | Argument | Submap |
|
| Modifiers | Key | Action | Argument | Submap |
|
||||||
|-----------+-------+--------+-----------------+--------|
|
|-----------+-------+--------+--------------------+--------|
|
||||||
| | Print | exec | =screenshot= | reset |
|
| | Print | exec | =screenshot= | reset |
|
||||||
| | c | exec | =screenshot -c= | reset |
|
|
||||||
| | s | exec | =screenshot -s= | reset |
|
|
||||||
| | g | exec | =screenshot -g= | reset |
|
|
||||||
| | d | exec | =screenshot -d 3= | reset |
|
| | d | exec | =screenshot -d 3= | reset |
|
||||||
|
| Shift | d | exec | =screenshot -sced 3= | reset |
|
||||||
|
| | e | exec | =screenshot -sec= | reset |
|
||||||
|
| | s | exec | =screenshot -s= | reset |
|
||||||
| Shift | s | exec | =screenshot -sc= | reset |
|
| Shift | s | exec | =screenshot -sc= | reset |
|
||||||
|
|
||||||
*** Windows
|
*** Windows
|
||||||
|
@ -234,20 +234,6 @@ UNREAD=$(mu find "flag:unread AND (maildir:/Inbox OR maildir:/Junk)" | wc -l)
|
|||||||
printf "^f2^f0%s" "$UNREAD"
|
printf "^f2^f0%s" "$UNREAD"
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
*** Post scrot script
|
|
||||||
:PROPERTIES:
|
|
||||||
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :tangle ~/.local/bin/post-scrot
|
|
||||||
:END:
|
|
||||||
It is possible to call a script on the resulting image of a ~scrot~
|
|
||||||
command. Not only do I want to move them to a specific directory, I
|
|
||||||
also want to be able to see them in ~nsxiv~ (a replacement for ~sxiv~) in
|
|
||||||
case I want to edit the image, copy it or simply delete it (sometimes
|
|
||||||
I take screenshots by accident).
|
|
||||||
#+begin_src sh
|
|
||||||
mv "$@" ~/Pictures/Screenshots/
|
|
||||||
nsxiv -abfs f "$HOME/Pictures/Screenshots/$*"
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
*** screenshot
|
*** screenshot
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/.local/bin/screenshot
|
:HEADER-ARGS: :shebang "#!/usr/bin/env sh" :mkdirp yes :tangle ~/.local/bin/screenshot
|
||||||
@ -269,7 +255,7 @@ OUTFILE_BASE="$HOME/Pictures/Screenshots/Screenshot_$(date +%Y%m%d)_$(date +%H%M
|
|||||||
OUTFILE="$OUTFILE_BASE.png"
|
OUTFILE="$OUTFILE_BASE.png"
|
||||||
SUFFIX=0
|
SUFFIX=0
|
||||||
|
|
||||||
while getopts ':cd:gs' OPTION; do
|
while getopts ':cd:egs' OPTION; do
|
||||||
case "$OPTION" in
|
case "$OPTION" in
|
||||||
c )
|
c )
|
||||||
COPY="yes"
|
COPY="yes"
|
||||||
@ -277,6 +263,9 @@ while getopts ':cd:gs' OPTION; do
|
|||||||
d )
|
d )
|
||||||
DELAY="$OPTARG"
|
DELAY="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
e )
|
||||||
|
EDIT="yes"
|
||||||
|
;;
|
||||||
g )
|
g )
|
||||||
GIMP="yes"
|
GIMP="yes"
|
||||||
;;
|
;;
|
||||||
@ -284,21 +273,29 @@ while getopts ':cd:gs' OPTION; do
|
|||||||
SELECT="yes"
|
SELECT="yes"
|
||||||
;;
|
;;
|
||||||
? )
|
? )
|
||||||
echo "Usage: $(basename "$0") [-c] [-d DELAY] [-g] [-s]"
|
echo "Usage: $(basename "$0") [-c] [-d DELAY] [-e] [-g] [-s]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$SELECT" = "yes" ]
|
||||||
|
then AREA="$(slurp)"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$DELAY" ]
|
if [ -n "$DELAY" ]
|
||||||
then sleep "$DELAY"
|
then sleep "$DELAY"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SELECT" = "yes" ]
|
if [ "$SELECT" = "yes" ]
|
||||||
then grim -g "$(slurp)" "$OUTFILE"
|
then grim -g "$AREA" "$OUTFILE"
|
||||||
else grim "$OUTFILE"
|
else grim "$OUTFILE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$EDIT" = "yes" ]
|
||||||
|
then swappy -f "$OUTFILE" -o "$OUTFILE"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$GIMP" = "yes" ]
|
if [ "$GIMP" = "yes" ]
|
||||||
then gimp "$OUTFILE"
|
then gimp "$OUTFILE"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user