Skip to content

Raspberry Pi: take a screenshot from a display with no keyboard and mouse

The Raspberry Pi in the kitchen runs relatively stable, but recently the browser (which is showing the openHAB HABpanel) popped up a warning in the upper right corner. That's annoying, because this area in HABpanel shows the outside temperature.

Before investigating what's going on, I had to figure out a way to get a screenshot of the display - without running into the kitchen with my mobile phone. And without attaching a keyboard all the time (to press the "Print" button).

 

The system is running Raspbian. The display manager is LXDE. Raspbian comes with a screenshot tool preinstalled: "scrot". The nice thing about it: I can take a screenshot from the commandline, while logging in over ssh.

All I had to do was to teach "scrot" where the display is. If you start it without any display settings, it can't connect to the X Server:

pi@raspberrypi:~ $ scrot
giblib error: Can't open X display. It is running, yeah?

The following environment variables need to be set: "DISPLAY" (pointing to the first display, which is "0"), and "XAUTHORITY" (pointing to the Xauthority file of the currently logged in user):

export DISPLAY=:0
export XAUTHORITY=/home/pi/.Xauthority

Both variables need to be exported, which in shell terminology means: any started program can see the environment variable as well. Otherwise it's just a variable for the shell itself.

After setting the two variables, I can take a screenshot:

pi@raspberrypi:~ $ scrot
pi@raspberrypi:~ $ ls -ld *.png
-rw-r--r-- 1 pi pi 31411 Feb 10 00:42 2020-02-10-004250_800x480_scrot.png

 

  • Twitter
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Raspberry Pi: take a screenshot from a display with no keyboard and mouse
  • Bloglines Raspberry Pi: take a screenshot from a display with no keyboard and mouse
  • Technorati Raspberry Pi: take a screenshot from a display with no keyboard and mouse
  • Fark this: Raspberry Pi: take a screenshot from a display with no keyboard and mouse
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at YahooMyWeb
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at Furl.net
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at reddit.com
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at blinklist.com
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at Spurl.net
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at Simpy.com
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse at blogmarks
  • Bookmark Raspberry Pi: take a screenshot from a display with no keyboard and mouse with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options