Skip to content

Instantly share code, notes, and snippets.

View jD91mZM2's full-sized avatar
I'm melting

jD91mZM2 jD91mZM2

I'm melting
View GitHub Profile
@jD91mZM2
jD91mZM2 / monitorshot2.sh
Last active May 10, 2020 13:25 — forked from naelstrof/monitorshot2.sh
Just screenshots the monitor that the mouse is on.
monitors="$(xrandr | grep -o '[0-9]*x[0-9]*[+-][0-9]*[+-][0-9]*')"
# Get the location of the mouse
eval "$(xdotool getmouselocation --shell --prefix mouse_)"
while read -r line; do
if [[ "$line" =~ ([0-9]+)x([0-9]+)([+-][0-9]+)([+-][0-9]+) ]]; then
specs="${BASH_REMATCH[0]}"
width="${BASH_REMATCH[1]}"
height="${BASH_REMATCH[2]}"
x="${BASH_REMATCH[3]}"