local-bin/bin/scrot.sh

39 lines
878 B
Bash
Raw Normal View History

2020-07-01 13:42:14 +03:00
#!/bin/sh
#
# Siina's bootleg screenshot capturer for use with global keybinds
#
# Requires:
# - maim: takes the screenshot
# - mpv: plays audio file upon completion
# - boop.sh: uploads screenshot to boop.icu
#
# Example global keybinds:
#
# TYPE CMD KEYBIND
#
# Fullscreen scrot.sh Print
# Main monitor scrot.sh --main Meta+Ctrl+Print
# Active window/Selct scrot.sh -s Meta+Print
#
# TODO: Autodetect mpv and boop.sh to make them optional
# TODO: Figure out how to capture a specific monitor, not just main
2020-07-01 13:42:14 +03:00
screendir="/data/nextcloud/Screenshots/"
sound="${HOME}/src/local-bin/sounds/shutter.ogg"
filename="$(date +'%Y%m%d_%H%M%S').png"
resolution="1920x1080"
args="-m 9 -u"
2020-07-01 13:42:14 +03:00
cd $screendir
if [[ ${1} == "--main" ]]; then
args="${args} -g 1920x1080+0+0"
else
args="${args} ${1}"
2020-07-01 13:42:14 +03:00
fi
2020-12-02 05:18:45 +02:00
maim -B $args $filename
mpv $sound
$HOME/.local/bin/boop.sh "$screendir$filename"
2020-07-01 13:42:14 +03:00