mirror of
https://github.com/oddlama/nix-config.git
synced 2025-10-10 23:00:39 +02:00
feat: convert screenshot scripts to wayland
This commit is contained in:
parent
3a0cec46f3
commit
3b602b322a
5 changed files with 97 additions and 72 deletions
|
@ -1,24 +1,23 @@
|
|||
{
|
||||
lib,
|
||||
writeShellApplication,
|
||||
flameshot,
|
||||
grimblast,
|
||||
libnotify,
|
||||
moreutils,
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "screenshot-screen";
|
||||
runtimeInputs = [
|
||||
grimblast
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
set -euo pipefail
|
||||
umask 077
|
||||
|
||||
date=$(date +"%Y-%m-%dT%H:%M:%S%:z")
|
||||
out="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-fullscreen.png"
|
||||
mkdir -p "$(dirname "$out")"
|
||||
|
||||
if ${lib.getExe flameshot} full --raw 2>&1 1> >(${moreutils}/bin/sponge "$out") | grep -q "flameshot: info:.*aborted."; then
|
||||
exit 1
|
||||
fi
|
||||
${libnotify}/bin/notify-send \
|
||||
grimblast --freeze save screen "$out" || exit 2
|
||||
notify-send \
|
||||
"📷 Screenshot captured" "💾 Saved to $out" \
|
||||
--hint="string:wired-tag:screenshot-$date" \
|
||||
|| true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue