Skip to content

Instantly share code, notes, and snippets.

@meganukebmp
Last active April 30, 2019 06:42
Show Gist options
  • Save meganukebmp/15fc3d248bd0c4f5d75e4d7dffbcfedd to your computer and use it in GitHub Desktop.
Save meganukebmp/15fc3d248bd0c4f5d75e4d7dffbcfedd to your computer and use it in GitHub Desktop.
A simple maim wrapper with xclip. Used with xfce4 keybinds.
#!/bin/bash
screenshot () {
# o - no openGL 3.0 (legacy mode)
# u - hide cursor
# b - border thickness (negative for inset)
# c - border color (RGBA)
# n - decoration level (window borders)
maim \
-n 0\
-u \
-f "png" \
-b -1 \
-c 0.22,0.83,0.96 \
$1 \
| xclip -selection clipboard -t image/png
# notify-send -t 1 -i "accessories-screenshot" "mshot" "screenshot copied to clipboard"
exit 0
}
usage () {
echo "Usage: $(basename $0) [-f|-w|-r|-h]"
echo " -f capture entire screen"
echo " -w capture active window"
echo " -r capture user selection"
echo " -h display this message"
exit 0
}
while getopts ":fwr" opt; do
case ${opt} in
f) # fullscreen option
screenshot ""
;;
w) # window option
screenshot "-i $(xdotool getactivewindow)"
;;
r) # region option
screenshot "-s"
;;
h | *) # help
usage
;;
esac
done
usage
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment