Wednesday, July 19, 2017

print screen on active window and copy it to clipboard

1- install
$ sudo apt-get install scrot xclip
$ mkdir /home/user1/scrot -p

*** capture.py ***
#!/usr/bin/python

import os

getactid = os.popen("xdotool getactivewindow").read()
os.system("scrot /home/user1/scrot/1.png -u ")
os.system("xclip -selection clipboard -t image/png -i /home/user1/scrot/1.png &")

winIda = getactid.strip()
print winIda
os.system("xdotool windowactivate " + winIda)



*** usage

$./capture.py

No comments:

Post a Comment