roger / escrotum Goto Github PK
View Code? Open in Web Editor NEWLinux screen capture using pygtk, inspired by scrot
License: GNU General Public License v3.0
Linux screen capture using pygtk, inspired by scrot
License: GNU General Public License v3.0
We only need a good preset to add recording video feature from #25
After upgrading to python 3.9, I can't seem to make it work. Running with -C
now fails silently with nothing copied to the clipboard and a 0 exit code and running with a filename produces a uniform black png with this output (and also a 0 exit code):
(escrotum:23207): GdkPixbuf-WARNING **: 10:00:03.461: Unrecognized parameter “quality” passed to the PNG saver
.
Is there anything I can do to debug the issue deeper?
Please, update the pip package.
scrot
has an option --focused
to select/use the focused window.
With escrotum you have to use something like escrotum --xid $(xdotool getactivewindow)
.
It would be nice if --focused
was supported for compatibility and ease of use.
After reading this issue:
#68
I was able to get escrotum working on python 3.10.1 again, however the issues I was having prior to installing escrotum as a python package and also installing python-numpy from AUR as mentioned as fix actions.. my issues were identical to the issues given when python upgraded to 3.9.
Everything from the original post in #68 is identical and relevant to the issue upgrading from python 3.9 to 3.10(.1), I am also running Arch Linux and I received the same exact errors.
As noted, installing python-numpy and running pip install escrotum
have fixed the issue in the meantime.
The pypi last uploaded version is 1.0.1, which is lacking of some additions to master, for example:
git diff 1.0.1..master -- setup.py
diff --git a/setup.py b/setup.py
index 10a75f7..1998cbc 100644
--- a/setup.py
+++ b/setup.py
@@ -12,8 +12,9 @@ setup(
include_package_data=True,
zip_safe=False,
install_requires=[
- 'gobject',
+ 'PyGObject',
'xcffib',
+ 'pycairo',
],
entry_points={
'console_scripts': [
That makes impossible to me to install in a virtual environment
$ python -m venv venv; source venv/bin/activate;
$ pip install escrotum
$ ./venv/bin/escrotum
Traceback (most recent call last):
File "/tmp/venv/./bin/escrotum", line 5, in <module>
from escrotum.main import run
File "/tmp/venv/lib/python3.10/site-packages/escrotum/main.py", line 9, in <module>
import gi
ModuleNotFoundError: No module named 'gi'
$ pip list
Package Version
---------- -------
cffi 1.16.0
escrotum 1.0.1
gobject 0.1.0
pip 22.0.2
pycparser 2.21
setuptools 59.6.0
xcffib 1.5.0
Hi Roger,
First let me say thank you for making escrotum, I'm very happy to see something continue on from scrot.
I use Openbox 3.5.2 and with scrot these are the commands I'd use for the keyboard print screen.
# Select a window
bash -c "scrot -s /home/foo/ScreenShots/screenshot-$(date +%m-%d-%Y).png"
# Select a window with frame
bash -c "scrot -sb /home/foo/ScreenShots/screenshot-$(date +%m-%d-%Y).png"
# Whole screen
bash -c "scrot /home/foo/ScreenShots/screenshot-$(date +%m-%d-%Y).png"
To use escrotum, 'select a window' and 'whole screen' I have these commands below, but not sure about select a window with frame?
Select a window (is this correct)?
bash -c "escrotum -s /home/foo
Select a window with frame? (how can I do this)?
bash -c "scrot -sb /home/foo
Whole Screen (is this correct)?
bash -c "escrotum /home/foo
Thank you very much for your time and help and keep up the great work, I hope you'll continue developing escrotum for some time.
With the current version, when making a screenshot of a selected window, the captured area starts outside of the window decoration (window decoration is 1px in my case), but uses the dimensions of the window content. This means that the decoration at the left and top side is captured, but the bottom and right side are slightly cropped.
Slightly related to #9.
To repro:
escrotum -s
Hi,
I'm running debian, python2.7.12 and i3 as a window manager.
When I use escrotum -s to capture a region, it works fine. However, when I want to capture a whole window, here's what I get as an error :
/usr/local/lib/python2.7/dist-packages/escrotum/main.py:240: GtkWarning: IA__gdk_x11_colormap_foreign_new: assertion 'xcolormap != None' failed
pb = pb.get_from_drawable(window, window.get_colormap(), x, y, 0, 0,
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/escrotum/main.py", line 241, in screenshot
width, height)
TypeError: Gdk.Pixbuf.get_from_drawable() argument 2 must be gtk.gdk.Colormap, not None
^CTraceback (most recent call last):
File "/usr/local/bin/escrotum", line 9, in <module>
load_entry_point('escrotum==0.2.1', 'console_scripts', 'escrotum')()
File "/usr/local/lib/python2.7/dist-packages/escrotum/main.py", line 382, in run
gtk.main()
Any Idea what the problem could be ?
Example:
$ escrotum -e "echo hello"
2016-12-07-233226_3600x1080_escrotum.png
hello
$ escrotum -C -e "echo hello"
(no output)
With rm
:
$ touch test && escrotum -e "rm ./test" && ls
2016-12-07-233534_3600x1080_escrotum.png
2016-12-07-233534_3600x1080_escrotum.png
$ touch test && escrotum -C -e "rm ./test" && ls
2016-12-07-233534_3600x1080_escrotum.png test
It only happens in selection mode. It works well when capturing the whole screen.
The environment is:
at the bottom of the man page, it is mentioned that the escrotum documentation is maintained as a texinfo page.
this is, as far as i can tell, a default thing that help2man adds in, but since this isn't actually true, shouldn't it be removed?
I don't have a lot of time this days to work with this project, so I'm looking for people who wants to mantain it, currently is working as I want but could have some improvements, like finishing #25 or releasing new versions(the last one it's from 2014), also packaging on archlinux should have some improvements.
If anyone it's interested, please let me know.
I'm using arch linux, on a thinkpad x1 yoga, with the package escrotum-git 0.2.1.r47.abcab0e-1
. This morning I upgraded using yay -Syu
as normal, and python got upgraded from 3.8 to 3.9. Running escrotum
in bash gave the following error:
Traceback (most recent call last): File "/usr/bin/escrotum", line 33, in <module> sys.exit(load_entry_point('escrotum==1.0.1', 'console_scripts', 'escrotum')()) File "/usr/bin/escrotum", line 22, in importlib_load_entry_point for entry_point in distribution(dist_name).entry_points File "/usr/lib/python3.9/importlib/metadata.py", line 524, in distribution return Distribution.from_name(distribution_name) File "/usr/lib/python3.9/importlib/metadata.py", line 187, in from_name raise PackageNotFoundError(name) importlib.metadata.PackageNotFoundError: escrotum
So that's how I learned that escrotum was a python package, and so I figured installing it with pip install escrotum
might fix the problem. After doing so, and running escrotum
again, I get the following error:
No numpy support, saving would be slower Traceback (most recent call last): File "/usr/bin/escrotum", line 33, in <module> sys.exit(load_entry_point('escrotum==1.0.1', 'console_scripts', 'escrotum')()) File "/home/ben/.local/lib/python3.9/site-packages/escrotum/main.py", line 534, in run Escrotum(filename=args.FILENAME, selection=args.select, xid=args.xid, File "/home/ben/.local/lib/python3.9/site-packages/escrotum/main.py", line 93, in __init__ self.start() File "/home/ben/.local/lib/python3.9/site-packages/escrotum/main.py", line 111, in start self.capture() File "/home/ben/.local/lib/python3.9/site-packages/escrotum/main.py", line 278, in capture self.capture_image(x, y, width, height, window) File "/home/ben/.local/lib/python3.9/site-packages/escrotum/main.py", line 294, in capture_image pb2 = self.mask_pixbuf(pb2, root_width, root_height) File "/home/ben/.local/lib/python3.9/site-packages/escrotum/main.py", line 368, in mask_pixbuf data = bgra2rgba(pixels, width, height) File "/home/ben/.local/lib/python3.9/site-packages/escrotum/util.py", line 111, in bgra2rgba data = array.array ("c", pixels) ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)
Anyway, I figure I can manually edit the main /usr/bin/escrotum
script to call python3.8, instead of just python, but manually editing files that are part of packages seems like a bad idea?
A square near the cursor showing exactly what pixel your mouse is over to select. As well as the selection's dimensions. Only features I really miss from ShareX.
With scrot
you can use $$
to have a literal $
in the -e
expression, but it does not work with escrotum:
% escrotum -e 'echo $$PWD'
2019-01-16-025022_1920x1080_escrotum.png
19867PWD
% scrot -e 'echo $$PWD'
/tmp
Hi
I run openbox with compton. When I use escrotum to select a region with a mouse, the screenshot is dark.
Please see here http://aanatoly.github.io/ndnd/
My guess is this: escrotum opens a transparent window, compton adds a shadow and draws it onto root window, escrotum grabs a region from root window. So closing escrotum window before taking the shot may solve this
With the newest version, images are not saved to clipboard. Running e.g. escrotum -sC
would normally do this - however, the clipboard is empty.
kernel version: 5.6.8-arch1-1
escrotum version: 0.2.1.r44.292766e-1
Hi @Roger ,
Many thanks for escrotu! A great replacement for the rather limited Gnome Screenshot.
One request. My default command (mapped to Print
key) use is as follows:
escrotum -d 10 -s -C
Since I don't see the CLI countdown timer, would it be possible to display a libnotify
notification for the countdown timer?
Thanks in advance!
Robert
Installed today on Ubuntu 18.04 via pip running i13wm 4.17.1.
~ ❯ escrotum -s ~/scrot.png
Gtk-Message: 10:29:09.016: GtkDialog mapped without a transient parent. This is discouraged.
No numpy support, saving would be slower
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 278, in capture
self.capture_image(x, y, width, height, window)
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 294, in capture_image
pb2 = self.mask_pixbuf(pb2, root_width, root_height)
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 368, in mask_pixbuf
data = bgra2rgba(pixels, width, height)
File "/usr/local/lib/python3.6/dist-packages/escrotum/util.py", line 111, in bgra2rgba
data = array.array ("c", pixels)
ValueError: bad typecode (must be b, B, u, h, H, i, I, l, L, q, Q, f or d)
^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 184, in event_handler
def event_handler(self, event):
KeyboardInterrupt
^C^C^C^C^C^C^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 184, in event_handler
def event_handler(self, event):
KeyboardInterrupt
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^CTraceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/escrotum/main.py", line 184, in event_handler
def event_handler(self, event):
KeyboardInterrupt
Had to sigkill the process.
what's this about?
$ escrotum -s -C
Gtk-Message: 17:58:17.515: Failed to load module "canberra-gtk-module"
the message shows up after I finish my selection
Hello,
In version 0.2.1 of escrotum, the following example is given in the help message:
Example:
escrotum '%Y-%m-%d_$wx$h_escrotum.png'
Creates a file called something like 2013-06-17-082335_263x738_escrotum.png
However, running the example command actually yields a file called something like: 2013-06-17_263x738_escrotum.png
This can either be fixed by changing the command to the correct one, i.e.
escrotum '%Y-%m-%d-%H%M%S_$wx$h_escrotum.png'
or change the name of the file to the correct one, i.e.
2013-06-17_263x738_escrotum.png
If you're too busy for this, let me know which fix you'd prefer and I can make a quick pull request.
This is a problem with scrot, too, but perhaps you guys can fix it.
Here is the problem with clipboard.
Hotkey printSc executes escrotum -s -C and it is creates copies of himself after executing command:
So, in the terminal
Stops after executing another copy of app through hotkey, in my case here
How to kill copies?
Sorry for further terminological and language grammar mistakes
Installed it with pip and got this error when executing the binary, whats wrong? Do I miss any dependence?
This might be by design, not sure if it's possible to keep an image in the clipboard after having closed the application, but the --clipboard option keep escrotum running until another instance of escrotum with --clipboard is executed.
Solution ideas:
If you hit escape or right click
Please directly support screenshot to clipboard.
When executing
escrotum -sr '%M%S.webm' -e 'echo $f'
It seems like it captures the timestamp, this is used for saving the file, but the -e parameter does not hold the old value of the timestamp, and thus returns the current timestamp instead of the filename.
This results in a different filename being printed from the one that is actually saved, see image;
When I want to screenshot a webpage, for example, using the escrotum
command works fine. But when I try and screenshot the webpage via its x-window's xid, and I use the command escrotum -x <window-id>
, then any tooltips that are on that webpage don't show up. Why aren't tooltips captured in the screenshot when using escrotum with the x-window id?
I think this is a bug. Any reason why this is occurring? It would be great to get this fixed!
Kernel version: linux-5.10.14.arch1-1
Escrotum version: escrotum-git 0.2.1.r48.a41d0f1-1
Python version: python-3.9.1-2
Using this, file isn't saving and isn't going to clipboard
escrotum -s -C '~/Pictures/Screenshots/screenshot_%d.%m.%Y_%H:%M:%S.png'
That works okay
escrotum -s '~/Pictures/Screenshots/screenshot_%d.%m.%Y_%H:%M:%S.png'
For example, if I want to save in /Pictures/screenshots, I have to use the full path." as substitution for the home directory doesn't work, neither does $HOME or a Regex.
"
Could be implemented using https://github.com/mikeboers/PyAV or calling ffmpeg via subprocess.
I used this tool all the time in i3, and I recently moved to Sway and noticed that the screenshots taken are completely black. That's when I realized escrotum only supports X. It would be nice to have support for Wayland though since it is getting more mainstream lately.
We should detect if the wm is reparenting and get the window inside the border window.
I saw the setup.py, but it seems you didn't upload it to PyPi which would allow a simple "pip install escrotum" to install it.
I'd also suggest a very short how to install in the README. It's a nice tool.
I recently updated my build of escrotum and when I select a region, I end up with a blank screenshot (completely black). Screenshots of an entire window or the entire display still work.
escrotum -s
If the selection starts in the top left corner everything is fine. But if it starts somewhere else, the dimensions are fine, but the content is shifted/placed in the wrong area. Depending on the area/offset from the corner it might be completely black.
e7ed25d on Arch Linux.
Have you ever considered rewriting this into Rust? I mean, Rust is a more memory-safe language and it has concurrency built-in, which will prevent you from any thread issue in the future. Also, you can compile it to different targets, so everybody can have their escrotum oxidated.
There is a import cairo
, but cairo is not listed as a dependency.
I am running two monitors in extended mode, how do I issue a screenshot of display #2? the Display name is HDMI-0 ?
I tried this: escrotum --xid=HDMI-0 ~/tmp/01.png
When using escrotum to take a screenshot, it shows a tint to help you define the area where you're selecting to screenshot. However since I updated pip
, the final screenshot taken includes that tint overlay making the images look darker. Is this a known bug or did something go awry when I updated pip
? I have re-installed but the issue still persists.
Example:
http://i.imgur.com/pMO0nIr.png
We should support/port Python 3.
escrotum exits from Escrotum.save_file before performing the check to exec commands
the call for normal exit in Escrotum.save_file should be moved to Escrotum.screenshot to resolve the issue
Occurred on Linux 5.15.7-xanmod1-tt-1 using xorg and i3wm
Steps to reproduce
escrotum -r '~/img/screenshots/%Y-%m-%d_%H-%M-%S.webm' -e 'echo $f'
Ctrl-Alt-s
Possible cause
It seems as though the filename's substitutions are getting expanded once at the beginning of capture, and then expanded a second time when the command executes, which means that the strftime(2)
evaluation will be different each time. By capturing the strftime once at the beginning of program execution we can ensure that this discrepancy will not exist.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.