Screenshot

From Pandora Wiki
Revision as of 22:54, 5 April 2011 by XxionxX (talk | contribs) (Install this script to the Nand)
Jump to: navigation, search

Short Version

According to this post by isSuE, you can take a screenshot by typing: 'fbgrab desired_file_name.jpg' (no quotes).

Or you can use this guide by SomeGuy99 to make a 'printscrn key'

Long Version

This is for those who feel that following the above link is too hard.

SomeGuy99's guide to making a screencap key

You may not know this, but your Pandora comes with a nice little shell command to make screenshots. The two problems that have to be overcome when using it are:

1) You have to specify a filename

When running the command, you specify a filename and path for the screenshot to be saved (in the PNG image format). This is a pain when you want to do multiple screen dumps! It means you have to make up a filename for each screenshot, or write over the previous one.

2) You have to run it from the terminal

Not only is typing in the full command rather tedious, but to run it you have to bring up a terminal window. Not much fun unless you want screenshots of a terminal window running the screenshot program!

In this guide, we'll overcome these problems as follows:

1) Auto increment filenames

We'll use a little Linux magic to append the filename with the date and time, giving it a unique name. We'll also specify the path to be your home directory, which is a reliable location for Linux to use (it will always be there).

2) Print Screen key

We'll wrap all the commands into a script and install it on the nand (internal) memory. This means that any program on your Pandora can invoke (run) a screenshot without having to bring up a terminal window. Our script will also have a little XFCE popup near the taskbar to inform us when we take screenshots.

After all this is done, we'll map it to a keyboard shortcut so it can be used anywhere on the XFCE desktop (although this won't work inside games or minimenu because the shortcuts rely on XFCE).

Part 1 - Making and installing the script

Paste the following into Mousepad and save it somewhere (I recommend the home directory) as 'snapsnap.sh' (although you can give it any name you like, just remember what you called it).

#!/bin/bash
fbgrab ~/screen`date +%y%m%d-%H%M%S`.png
notify-send snapsnap

Breakdown of what it does:

'#!/bin/bash' - We're telling Linux "Hey! This file is a script!". Bash is a shell for Linux that runs inside a terminal. What's the difference? Well the terminal program, or any terminal in Linux, just deals with taking in lines of text (the line you typed in) and output text from the shell. You can consider it a frontend for the shell, which does all the actual work of figuring out what to do with your inputted text, and what to send back to you. The shell itself talks to Linux, like a middle man.

'fbgrab' - The utility for making screendumps. 'fb' refers to the 'frame buffer' which is the technical term for all the pixels on your screen at any one time, stored in memory.

'~/' - A shortcut for Linux that refers to your current home directory. If you change users, this location changes with it.

`date +%y%m%d-%H%M%S` - These are not quotation marks, everything inside these little marks will be figured out seperately, then the result will appear as if the command inside them never existed. You can think of it like how in algebra, the contents of brackets are worked out first. The command we are running is 'date', which just lists the current date or time. We have passed parameters to it, in the format it expects to say we want 'year,month,day-hour,minute,second'. This is then spliced into the full filename.

'notify-send snapsnap' - Another Linux utility to send pop-up notifications on the taskbar. We are making it say 'snapsnap' so we can be sure a screenshot has been taken!

Install this script to the Nand

We need to make this file executable first. Go to the folder you saved it in using Thunar, then rightclick 'open terminal here'.

Type one of the following in and hit enter:

chmod ugo+rwx snapsnap.sh

^give access to all users

chmod +x snapsnap.sh

^give executable access to the current user (the one you are logged in as)

Breakdown of what that did:

chmod - Another security feature is that files can be marked as executable or not, and who can read, write and execute them. Each file has individual 'permissions' on how it can be used.

'ugo' - We are saying 'please change permissions for this user (U), all members of this users group (g) and anyone outside the users group (O - other).

'+' - 'Please set these permissions to positive!' In other words, a highlighted tick box or 'on' switch.

'rwx' - 'Please change those permissions for reading the file ( r ), writing the file (w) and executing (x)

Now try and run the script!

./snapsnap.sh

You see a popup saying 'snapsnap' and a screenshot should appear in your home directory. Nice one!

Installing this script

Type the following and hit enter:

sudo cp snapsnap.sh /usr/bin/snapsnap

Sudo - Stands for 'superuser do'. We are saying 'run this admin command please' and then sudo will say 'Okay fine, but give me your password!'. This is a Linux security feature to prevent hackers and bad scripts (in theory) from messing up your system without asking you first.

/usr/bin is where commands live. From here they can be executed anywhere on your system. At the moment you need to be in the folder you saved it to. We are removing the '.sh' because this means to run the command you only have to type 'snapsnap'. It's a good idea to leave the draft versions with the .sh on the end, so you know they are shell scripts!

Now type the following and hit enter:

snapsnap

Congrats, you should now have two screenshots of you making screenshots!

Keyboard shortcut

Open up the keyboard shortcut settings (settings->keyboard from the menu).

Go to the tab 'Application shortcuts'.

Drag the window up with shift(also the left shoulder button) and drag (you can drag anywhere on the window).

Click 'add'.

Now it wants a command to run. Type in 'snapsnap' (without the quotations).

Hit okay or press enter.

Now it wants a keyboard shortcut. Use something obscure that won't already be used by applications. I recommend something like ctrl-alt-s.

Now one final thing

Open up mousepad. Type 'I made a screenshot'. Press your keyboard shortcut.