Skip to content

Instantly share code, notes, and snippets.

View Defman21's full-sized avatar
🌚
yeah, but Github is like a 3rd party thing...

Sergey Kislyakov Defman21

🌚
yeah, but Github is like a 3rd party thing...
View GitHub Profile
@Defman21
Defman21 / screenshot.sh
Last active January 15, 2017 11:04
Elementary Screenshot script
#!/bin/bash
FILE="$HOME/tmp.png"
PROGRAM="$(xprop -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) WM_CLASS | awk -F: 'BEGIN { FS="="; } {print $2}' | awk 'match($1,/[a-z-]+/) {print substr($1,RSTART,RLENGTH)}')"
GTKVERSION="$(ldd /usr/bin/$PROGRAM | grep libgtk | awk '{print $1;}' | tail -n1)"
SCRPROGRAM="gnome-screenshot $1 -e none -f $FILE"
REGEX="libgt(k|kd)-3*"
if [[ $GTKVERSION =~ $REGEX && $1 == "-w" ]]