feat(desktop): copy screenshots before annotation
This commit is contained in:
@@ -4,25 +4,27 @@
|
|||||||
pkgs,
|
pkgs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
# Keyboard-driven screenshots that open in satty for annotation, then land in
|
# Keyboard-driven screenshots copy to the clipboard before Satty opens for
|
||||||
# both the clipboard and a dated file.
|
# annotation. Satty copies annotated screenshots when it saves them.
|
||||||
let
|
let
|
||||||
cfg = config.modules.desktop.utilities.screenshot; # NOLINT(let_order)
|
cfg = config.modules.desktop.utilities.screenshot; # NOLINT(let_order)
|
||||||
user = config.user.name;
|
user = config.user.name;
|
||||||
|
|
||||||
grimblast = "${pkgs.grimblast}/bin/grimblast";
|
grimblast = "${pkgs.grimblast}/bin/grimblast";
|
||||||
satty = "${pkgs.satty}/bin/satty";
|
satty = "${pkgs.satty}/bin/satty";
|
||||||
|
tee = "${pkgs.coreutils}/bin/tee";
|
||||||
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
|
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
|
||||||
xdgUserDir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir";
|
xdgUserDir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir";
|
||||||
|
|
||||||
# satty's copy action also saves, so one keystroke lands the shot in both the
|
# Copy the original screenshot before Satty opens.
|
||||||
# clipboard and a file.
|
# Satty copies and saves annotated screenshots when the user presses Enter.
|
||||||
capture =
|
capture =
|
||||||
target:
|
target:
|
||||||
pkgs.writeShellScript "screenshot-${target}" ''
|
pkgs.writeShellScript "screenshot-${target}" ''
|
||||||
dir="$(${xdgUserDir} PICTURES)/Screenshots"
|
dir="$(${xdgUserDir} PICTURES)/Screenshots"
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
${grimblast} save ${target} - \
|
${grimblast} save ${target} - \
|
||||||
|
| ${tee} >(${wl-copy}) \
|
||||||
| ${satty} --filename - \
|
| ${satty} --filename - \
|
||||||
--output-filename "$dir/screenshot-%Y%m%d-%H%M%S.png" \
|
--output-filename "$dir/screenshot-%Y%m%d-%H%M%S.png" \
|
||||||
--copy-command ${wl-copy} \
|
--copy-command ${wl-copy} \
|
||||||
|
|||||||
Reference in New Issue
Block a user