From 5d1f441194fd5be62e2fb91db7a891791425cb50 Mon Sep 17 00:00:00 2001 From: foo-dogsquared Date: Wed, 25 Dec 2019 11:48:55 +0800 Subject: [PATCH] Update some scripts --- bin/prompt | 2 +- bin/screenshot | 24 +++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/bin/prompt b/bin/prompt index 87c5c63..f1b0c9a 100644 --- a/bin/prompt +++ b/bin/prompt @@ -3,4 +3,4 @@ # Based from Luke Smith's prompt script. # https://github.com/LukeSmithxyz/voidrice/blob/master/.local/bin/prompt -([ "$(printf "No\\nYes" | rofi -dmenu -p "$1")" = "Yes" ] && $2) || notify-send "The command "$2" failed to execute." +[ "$(printf "No\\nYes" | rofi -dmenu -p "$1")" = "Yes" ] && $2 diff --git a/bin/screenshot b/bin/screenshot index 2f51649..c8ad15c 100644 --- a/bin/screenshot +++ b/bin/screenshot @@ -28,13 +28,13 @@ Usage: $0 [-o/--output ] [-s/--select] Options: --help - show the help section --s, --select - set the screenshot capture to selection mode --d, --delay - set a delay for the capture - (in seconds) --o, --output - set the output path for the picture; - when given no output, the picture will - be moved to \$PICTURES_DIRECTORY (or - at \$HOME/Pictures if it's missing) +-s, --select - set the screenshot capture to selection mode +-d, --delay - set a delay for the capture (in seconds) +-c, --cursor - superimposes the cursor in the image +-o, --output - set the output path for the picture; + when given no output, the picture will + be moved to \$PICTURES_DIRECTORY (or + at \$HOME/Pictures if it's missing) " # setting up a exit trap in case of error @@ -57,13 +57,14 @@ do OUTPUT="$2" shift shift;; + -c|--cursor) + CURSOR=1 + shift;; *) shift;; esac done -set -- "${POSITIONAL[@]}" # restore positional parameters - if [[ -n "$OUTPUT" ]]; then pic_filepath=$OUTPUT else @@ -98,6 +99,11 @@ if [[ $DELAY -gt 0 ]]; then notify-send "Delayed screenshot" "A delayed screenshot is about to be taken in $DELAY seconds." --expire-time=$(( ($DELAY * 1000) - 1000 )) fi +# Checking if the cursor option is disabled. +if [[ $CURSOR -ne 1 ]]; then + maim_command+="--hidecursor " +fi + $($maim_command) if [[ $? != 0 ]]; then