From e8312903dbcf7ba2478e97a268b8b00a21ec34ba Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 2 Aug 2022 19:36:59 -0700 Subject: [PATCH] Added print screenshot command --- modules/screenshot/init.lua | 12 ++++++++++++ modules/screenshot/screenshot.fish | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/modules/screenshot/init.lua b/modules/screenshot/init.lua index f8f0fab..9ecc2a4 100644 --- a/modules/screenshot/init.lua +++ b/modules/screenshot/init.lua @@ -52,5 +52,17 @@ return { group = "Screenshot" } ) + ), + + awful.key( {"Shift", "Control", "Mod1"}, "Print", + function () + -- Make sure your default printer is set in CUPS! + screenshot_action("lpr") + end, + + { + description = "Print a screenshot", + group = "Screenshot" + } ) } diff --git a/modules/screenshot/screenshot.fish b/modules/screenshot/screenshot.fish index 97df369..10e018f 100755 --- a/modules/screenshot/screenshot.fish +++ b/modules/screenshot/screenshot.fish @@ -43,6 +43,14 @@ function capture echo $ocr | sed -e "s/^[ \t]*//" | xclip -i -rmlastnl -selection clipboard rm $tmp_file + case lpr + # Default printer must be set for the lpr command to work. + + # TODO: don't lpr if screenshot is cancelled. + flameshot gui --accept-on-select --path $tmp_file + convert $tmp_file $tmp_file.pdf + lpr -T "Autoprint Screenshot" $tmp_file.pdf + rm $tmp_file case "*" echo "Unknown action \"$argv[1]\""