summaryrefslogtreecommitdiff
path: root/.local/bin/screenshot
diff options
context:
space:
mode:
authoradam <56338480+adastx@users.noreply.github.com>2022-10-10 01:20:33 +0200
committeradam <56338480+adastx@users.noreply.github.com>2022-10-10 01:20:33 +0200
commit0375f1c658571190d1b26ac8c12dac1b3ff8821e (patch)
treeb83f1fcc7f49b2d1a1a6d37988400b6b437c00e6 /.local/bin/screenshot
parent9d1ef47d9757260631f96c879b02c0221e188648 (diff)
scripts: cleanup
Diffstat (limited to '.local/bin/screenshot')
-rwxr-xr-x.local/bin/screenshot28
1 files changed, 18 insertions, 10 deletions
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 "$@"