Skip to content

Instantly share code, notes, and snippets.

@brandon-lockaby
Last active October 19, 2021 07:11
Show Gist options
  • Save brandon-lockaby/d03df1aa5f951feec9da54be9e1831d2 to your computer and use it in GitHub Desktop.
Save brandon-lockaby/d03df1aa5f951feec9da54be9e1831d2 to your computer and use it in GitHub Desktop.
screenshot/clipboard hotkey scripts
#!/bin/bash
now=$(date +"%Y %m-%d %T ns%N")
xclip -selection clipboard -t TARGETS -o | (while IFS= read -r line; do
echo $line
if [[ $line = image/* ]]
then
notify-send "Opening ${line} with feh" -a "(•ิ_•ิ)?" -t 2000
xclip -selection clipboard -t image/png -o | feh -
break
fi
if [[ $line = text/* ]]
then
notify-send "Opening ${line} with code" -a "(•ิ_•ิ)?" -t 2000
xclip -selection clipboard -t text/plain -o | code -
break
fi
if [[ $line = video/* ]]
then
notify-send "Opening ${line} with vlc" -a "(•ิ_•ิ)?" -t 2000
xclip -selection clipboard -t text/plain -o | vlc -
break
fi
done )
echo "and that's all"
#!/bin/bash
maim -s | xclip -selection clipboard -t image/png
notify-send "Region to clipboard" -a "📋️" -t 1000
#!/bin/bash
xclip -selection clipboard -t TARGETS -o | grep -i 'image/png' &> /dev/null
if [ $? == 0 ]
then
now=$(date +"%Y %m-%d %T ns%N")
filename="${now}.png"
path="/mnt/tera/pictures/${filename}"
echo "saving ${path}"
xclip -selection clipboard -t image/png -o > "$path"
notify-send "saved $filename" -a "◎ヽ(^・ω・^=)~" -t 5000
else
echo "No image/png target"
notify-send "No image/png target" -a "(•ิ_•ิ)?" -t 2000
fi
#!/bin/bash
maim | xclip -selection clipboard -t image/png
notify-send "Screenshot to clipboard" -a "📋️" -t 1000
#!/bin/bash
now=$(date +"%Y %m-%d %T ns%N")
echo "$now" | xclip -selection c
#!/bin/bash
maim -i $(xdotool getactivewindow) | xclip -selection clipboard -t image/png
notify-send "Window to clipboard" -a "📋️" -t 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment