From 0375f1c658571190d1b26ac8c12dac1b3ff8821e Mon Sep 17 00:00:00 2001 From: adam <56338480+adastx@users.noreply.github.com> Date: Mon, 10 Oct 2022 01:20:33 +0200 Subject: scripts: cleanup --- .local/bin/screenshot | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to '.local/bin/screenshot') diff --git a/.local/bin/screenshot b/.local/bin/screenshot index 6d65898..3eed12b 100755 --- a/.local/bin/screenshot +++ b/.local/bin/screenshot @@ -1,17 +1,25 @@ #!/bin/sh -if [ ! -n "$1" ]; then - scrot -q 100 -e 'xclip -selection c -t image/png < $f; mv $f ~/Pictures/screenshots/' -fi +main () { + if [ ! -n "$1" ]; then + print_screen + fi -while [ -n "$1" ]; do # while loop starts case "$1" in -s) - sleep 0.2 - scrot -l mode=edge -i -s -e 'xclip -sel clip -t image/png $f; mv $f ~/Pictures/screenshots/' - ;; - *) echo "Option $1 not recognized" ;; + screenshot-select ;; + *) + echo "usage: screenshot [-s]" ;; esac - shift -done +} + +print_screen () { + scrot -q 100 -e 'xclip -selection c -t image/png < $f; mv $f ~/Pictures/screenshots/' +} + +screenshot-select () { + sleep 0.2 + scrot -l mode=edge -i -s -e 'xclip -sel clip -t image/png $f; mv $f ~/Pictures/screenshots/' +} +main "$@" -- cgit v1.2.3-70-g09d2