From 27e27c11ce09134201d30258509cead380f93c2f Mon Sep 17 00:00:00 2001 From: Oliver Atkinson Date: Sun, 20 Aug 2023 06:42:01 -0600 Subject: [PATCH] more commands --- .bashrc | 3 +++ .local/bin/screenshot | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100755 .local/bin/screenshot diff --git a/.bashrc b/.bashrc index 81367d5..2151527 100644 --- a/.bashrc +++ b/.bashrc @@ -16,7 +16,10 @@ alias bell="paplay /usr/share/sounds/freedesktop/stereo/complete.oga" alias useage="du -h -d 1 2> /dev/null | sort -h" # For laptop multi-gpu offloading alias nvidia_gpu="DRI_PRIME=1 __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia" +# Opinionated defaults alias feh="swallow feh --force-aliasing --draw-exif --scale-down --draw-filename" +alias ffplay="swallow ffplay $@" +alias shutdown="shutdown -P now" export DENO_INSTALL="/home/oliver/.deno" export PATH="$DENO_INSTALL/bin:$PATH" diff --git a/.local/bin/screenshot b/.local/bin/screenshot new file mode 100755 index 0000000..1e5e635 --- /dev/null +++ b/.local/bin/screenshot @@ -0,0 +1,46 @@ +notify-send "Postion 1" +sleep 2 +eval $(xdotool getmouselocation --shell) +X1=$X +Y1=$Y + +notify-send "Postion 2" +sleep 2 + +eval $(xdotool getmouselocation --shell) +X2=$X +Y2=$Y + +# X COORDS +if [[ $X2 -ge $X1 ]]; then + X=$X1 + W=$(($X2-$X1)) +else + X=$X2 + W=$(($X1-$X2)) +fi + +# Y COORDS +if [[ $Y2 -ge $Y1 ]]; then + Y=$Y1 + H=$(($Y2-$Y1)) +else + Y=$Y2 + H=$(($Y1-$Y2)) +fi + +CLIPBOARD="0" +DISK="1" +SAVE=$(notify-send "How to save?" --action=$CLIPBOARD=Clipboard --action=$DISK=Disk --expire-time=99999) + +if [[ $SAVE == $CLIPBOARD ]]; then + shotgun - | xclip -selection clipboard -target image/png -i +elif [[ $SAVE == $DISK ]]; then + shotgun -g ${W}x${H}+${X}+${Y} ~/Pictures/$(date +%a%b%d-%G-%s).png +else + # They let the notification expire + echo 0 +fi + + +