From aff5a78e79dcccca43eeee53491f9a81a8025ce4 Mon Sep 17 00:00:00 2001 From: DeaDvey Date: Wed, 2 Oct 2024 23:29:02 +0100 Subject: [PATCH] inital commit --- README.md | 2 ++ install.sh | 35 +++++++++++++++++++++++++++++++++++ screenshot | 2 ++ screenshot-w.sh | 8 ++++++++ screenshot-wayland | 2 ++ screenshot.sh | 4 ++++ 6 files changed, 53 insertions(+) create mode 100755 install.sh create mode 100644 screenshot create mode 100755 screenshot-w.sh create mode 100644 screenshot-wayland create mode 100755 screenshot.sh diff --git a/README.md b/README.md index 761f63f..67f5d08 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # screenshot +Screenshot a region of the screen and copy as welll as save it to a folder +run the install script (you may need to ```chmod +x install.sh``` it) diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..965dca4 --- /dev/null +++ b/install.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +echo "You need xclip and maim installed for the xorg screenshot tool" +echo "You need slurp, grim and wl-clipboard for the wayland screenshot tool" +read -p 'do you have these tools installed? (y/n): ' confirmation +if [ $confirmation = 'y' ] +then + echo 'continuing...' +else + echo 'exiting...' + exit 1 + +fi +read -p 'if you use wayland press w, if you use xorg press x: ' Display + +if [ $Display = 'w' ] +then + sudo cp screenshot-wayland /usr/bin + sudo chmod +x /usr/bin/screenshot-wayland + cp screenshot-w.sh $HOME + sudo chmod +x $HOME/screenshot-w.sh + mkdir $HOME/Screenshots + +elif [ $Display = 'x' ] +then + sudo cp screenshot /usr/bin + sudo chmod +x /usr/bin/screenshot + cp screenshot.sh $HOME + sudo chmod +x $HOME/screenshot.sh + mkdir $HOME/Screenshots + +else + echo 'you did not press w or x' + exit 1 +fi diff --git a/screenshot b/screenshot new file mode 100644 index 0000000..5b727fd --- /dev/null +++ b/screenshot @@ -0,0 +1,2 @@ +#!/bin/bash +$HOME/screenshot.sh diff --git a/screenshot-w.sh b/screenshot-w.sh new file mode 100755 index 0000000..2807b11 --- /dev/null +++ b/screenshot-w.sh @@ -0,0 +1,8 @@ +set -x + +filename=$(date +"%d:%m:%Y-%H:%M:%S-screenshot.png") + +touch $HOME/Screenshots/$filename + +grim -g "$(slurp)" "$HOME/Screenshots/$filename" +wl-copy < "$HOME/Screenshots/$filename" diff --git a/screenshot-wayland b/screenshot-wayland new file mode 100644 index 0000000..9579010 --- /dev/null +++ b/screenshot-wayland @@ -0,0 +1,2 @@ +#!/bin/bash +$HOME/screenshot-w.sh diff --git a/screenshot.sh b/screenshot.sh new file mode 100755 index 0000000..fa212c2 --- /dev/null +++ b/screenshot.sh @@ -0,0 +1,4 @@ +#!/bin/sh +time=$(date +"%d,%m,%Y--%H:%M:%S") +maim -s --format png $HOME/Screenshots/$time.png | -u +cat $HOME/Screenshots/$time.png | xclip -selection clipboard -target image/png -i