From 3535cc99eff9c94a0c1dc2791c61b94c6251cd42 Mon Sep 17 00:00:00 2001 From: Lucas Barbieri Date: Mon, 15 Jan 2024 14:17:58 -0300 Subject: [PATCH] add wayprint script i copied it from prasanthrangan/hyprdots and tweaked it to my likings, adding a temporary upload file :) --- desktop/scripts/way-print.sh | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 desktop/scripts/way-print.sh diff --git a/desktop/scripts/way-print.sh b/desktop/scripts/way-print.sh new file mode 100755 index 0000000..415683d --- /dev/null +++ b/desktop/scripts/way-print.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env sh + +swpy_dir="${XDG_CONFIG_HOME:-$HOME/.config}/swappy" +save_dir="$HOME/pics/screenshots" +save_file="screenshot-$(date -Iseconds | cut -d '+' -f1).png" +temp_screenshot="/tmp/screenshot.png" + +mkdir -p $save_dir +mkdir -p $swpy_dir +echo -e "[Default]\nsave_dir=$save_dir\nsave_filename_format=$save_file" > $swpy_dir/config + +upload () +{ + curl -F'file=@'"${save_dir}/${save_file}" -Fsecret= -Fexpires=24 https://0x0.st | wl-copy +} + +function print_error +{ +cat << "EOF" + ./screenshot.sh + ...valid actions are... + p : print all screens + s : snip current screen + sf : snip current screen (frozen) + m : print focused monitor +EOF +} + +case $1 in +p) # print all outputs + grimblast copysave screen $temp_screenshot && swappy -f $temp_screenshot ;; +s) # drag to manually snip an area / click on a window to print it + grimblast copysave area $temp_screenshot && swappy -f $temp_screenshot ;; +sf) # frozen screen, drag to manually snip an area / click on a window to print it + grimblast --freeze copysave area $temp_screenshot && swappy -f $temp_screenshot ;; +m) # print focused monitor + grimblast copysave output $temp_screenshot && swappy -f $temp_screenshot ;; +t) #upload to 0x0.st temporarily + grimblast copysave area $temp_screenshot && swappy -f $temp_screenshot && upload ;; +*) # invalid option + print_error ;; +esac + +rm "$temp_screenshot"