Get me what’s showing!

Standard

In a previous post, I showed how I made a plasma screen display system using shell scripts.  Today I was thinking “It’d be handy to know what’s displaying when I’m not near the screens themselves” so I figured a way of getting me quick snapshots.  Below is the script:



#!/bin/bash
ssh user@remotehost "DISPLAY=:0.0 import -window root /home/user/Pictures/face.png; exit" &&


scp user@remotehost:/home/user/Pictures/face.png /home/local/ &&


ssh user@remotehost "rm /home/user/Pictures/face.png; exit" &&


ristretto /home/local/face.png

Researching this taught me how to incorporate commands into the SSH login process itself, using quotes to contain the command.  I make sure that screen 0 is used using DISPLAY and then the import command (from Imagemagick tools on the server).  Then it’s a case of SCP’ing across to me locally and then using Ristretto image viewer to display it.

Sources:
Stack Overflow (Multiple commands in SSH)
CommandLineFU (Taking a screenshot through SSH)

Advertisements

2 thoughts on “Get me what’s showing!

  1. Interesting. It seems like it would be a good idea to create the filename based on something unique, like a timestamp. Also, this technique requires that a file is created (and left) on the remote box. Is it possible to pipe it over to the client without the step of saving it to disk first?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s