forked from mirrors_public/oddlama_nix-config
feat: use flameshot for screenshotting (twice as fast for fullscreen)
This commit is contained in:
parent
667fa26f14
commit
d081e70d78
5 changed files with 43 additions and 16 deletions
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
lib,
|
||||
writeShellApplication,
|
||||
flameshot,
|
||||
libnotify,
|
||||
xclip,
|
||||
maim,
|
||||
zbar,
|
||||
yq,
|
||||
zbar,
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "screenshot-area-scan-qr";
|
||||
|
@ -19,10 +20,12 @@ writeShellApplication {
|
|||
TMPFILE=/dev/fd/3
|
||||
|
||||
date=$(date +"%Y-%m-%dT%H:%M:%S%:z")
|
||||
out="''${XDG_PICTURES_DIR-$HOME/Pictures}/screenshots/$date-selection.png"
|
||||
mkdir -p "$(dirname "$out")"
|
||||
|
||||
if ${maim}/bin/maim --color=.4,.7,1 --bordersize=1.0 --nodecorations=1 --hidecursor --format=png --quality=10 --noopengl --select \
|
||||
# Always use native scaling to ensure flameshot is fullscreen across monitors
|
||||
export QT_AUTO_SCREEN_SCALE_FACTOR=0
|
||||
export QT_SCREEN_SCALE_FACTORS=""
|
||||
|
||||
if ${lib.getExe flameshot} gui --raw \
|
||||
| ${zbar}/bin/zbarimg --xml - > "$TMPFILE"; then
|
||||
N=$(${yq}/bin/xq -r '.barcodes.source.index.symbol | if type == "array" then length else 1 end' < "$TMPFILE")
|
||||
# Append codes Copy data separated by ---
|
||||
|
@ -33,7 +36,7 @@ writeShellApplication {
|
|||
${xclip}/bin/xclip -selection clipboard <<< "$DATA"
|
||||
${libnotify}/bin/notify-send \
|
||||
"🔍 QR Code scan" "✅ $N codes detected\n📋 copied ''${#DATA} bytes" \
|
||||
--hint="string:image-path:$out" \
|
||||
--hint="string:image-path:"${./assets/qr-scan.svg} \
|
||||
--hint="string:wired-tag:screenshot-$date" \
|
||||
|| true
|
||||
else
|
||||
|
@ -41,14 +44,14 @@ writeShellApplication {
|
|||
"4")
|
||||
${libnotify}/bin/notify-send \
|
||||
"🔍 QR Code scan" "❌ 0 codes detected" \
|
||||
--hint="string:image-path:$out" \
|
||||
--hint="string:image-path:"${./assets/qr-scan.svg} \
|
||||
--hint="string:wired-tag:screenshot-$date" \
|
||||
|| true
|
||||
;;
|
||||
*)
|
||||
${libnotify}/bin/notify-send \
|
||||
"🔍 QR Code scan" "❌ Error while processing image: zbarimg exited with code $?" \
|
||||
--hint="string:image-path:$out" \
|
||||
--hint="string:image-path:"${./assets/qr-scan.svg} \
|
||||
--hint="string:wired-tag:screenshot-$date" \
|
||||
|| true
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue