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:
| |
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):
| |
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:
| |
Comments
With an account on the Fediverse or Mastodon, you can respond to this post. Known replies are displayed below:
Note: This will load data from mastodon.social.
Learn how this is implemented here.
Share: