1
1
Fork 1
mirror of https://github.com/oddlama/nix-config.git synced 2025-10-10 23:00:39 +02:00

feat: use flameshot for screenshotting (twice as fast for fullscreen)

This commit is contained in:
oddlama 2023-10-16 02:10:32 +02:00
parent 667fa26f14
commit d081e70d78
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
5 changed files with 43 additions and 16 deletions

View file

@ -1,9 +1,11 @@
{
lib,
writeShellApplication,
flameshot,
libnotify,
xclip,
moreutils,
tesseract,
maim,
xclip,
}:
writeShellApplication {
name = "screenshot-area";
@ -15,8 +17,12 @@ writeShellApplication {
out="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-selection.png"
mkdir -p "$(dirname "$out")"
${maim}/bin/maim --color=.4,.7,1,0.2 --bordersize=1.0 --nodecorations=1 \
--hidecursor --format=png --quality=10 --noopengl --select "$out"
# Always use native scaling to ensure flameshot is fullscreen across monitors
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCREEN_SCALE_FACTORS=""
# Use sponge to create the file on success only
${lib.getExe flameshot} gui --raw | ${moreutils}/bin/sponge "$out"
${xclip}/bin/xclip -selection clipboard -t image/png < "$out"
action=$(${libnotify}/bin/notify-send \
"📷 Screenshot captured" "📋 copied to clipboard" \