Search

Turning the screen blank from command line

Screensavers are used to cover the desktop with some images or graphics while we are away from the system.

Here is how we can enable the screen saver from the command line. The screen saver from the command line will basically turn the screen blank and turn it on again only on detecting a user activity or when the command to turn off the screen saver is sent.

The first step to activate screensaver from the command line is the start the screensaver using the command



After the command has been executed we can activate the screensaver using the command



As soon as the command is executed the screen turns blank and comes back to life on any press of key or mouse movement.
Note that after being activated it will prompt for the user password before displaying the desktop.

We can also simulate a user activity from command line by passing the option "-p" to the command gnome-screensaver-command, which is equivalent to poking the screensaver like a user.

Thus to make the screen blank for 5 minutes we do



The above set of command will make the screen blank for 5 seconds and then reactivate the screen after 5 seconds.
To prevent from being prompted for password on activation of the screen, we can use the option -d instead of -p, which is to deactivate the screensaver.

We can create a script with the above commands, as required, and add it to the panel as a quick launcher, to give us the facility of quickly blanking the screen whenever required.


Creating blend effect using gimp

Using gimp we can create animated gif image with a blending effect, that is one image blends into another as shown below.

 photo linux_is_freedom.gif

Here is how we can create the above animation in gimp.

First we need the images we need to use for the blend effect, in the above animation we have used the following three images created using gimp itself.

 photo linux.jpg

 photo is.jpg

 photo Freedom.jpg

They can be created using the logo creation tool available under file->create->logos and the above effect is glossy.

Once the images are ready, open gimp.

click on



choose a template size bigger than the biggest of the images to be used in animation and click on ok.

Drag and drop the images into gimp in the order in which the images have to appear in the animation.

For the above animation we will drop "linux.jpg" first, then "is.jpg" and then ""freedom.jpg".

 photo layers.jpg

Now click on

 photo blend_menu.jpg

The following menu will appear.

 photo blend_options.jpg

The number of intermediate frames decide how slow the transition from one image to another should happen. In the above animation we have chosen the number to be 20 to make the transition happen slowly.

The blur option is to choose how much should the image blur before appearing and disappearing, the above animation has 0 blur. Click on "ok" and wait for gimp to do the magic. Once done we should see a new window as follows.

 photo after_blend.jpg

To preview the animation click on

Click on the play button to see the animation. If the animation is satidfactory close the preview and save the animation by clicking on



Enter the name and add the extension .gif example blend.gif

save_as photo save_as.jpg

A menu as below will be shown, click on save as animation and click on export

export_animation photo export_animation.jpg

In the next window we can choose the delay between individual frames, but in this case we can leave it as default and click on save and the animation should be ready.

final_save photo final_save.jpg


Viewing thumbnails of xcf using linux.

When we create images using the gimp, the default format in which the images get saved are .xcf. eXperimental Computing Facility.

The .xcf files, though they have images, are not visible as thumbnails and are shown as below even in the thumbnail view.

xcf no thumbnail photo no_xcf.png

To be able to view the .xcf files in thumbnail view properly in gnome, we need to install the package

gnome-xcf-thumbnailer i.e run the command



or search for the package in the the synaptic package manager and install te same.
Once the package gets installed, log out of the system and login. Now open the folder that has the xcf file and we should be able to view the thumbnail of the xcf file as shown below.

 photo xcf_thumb.png


VI error "Found a swap file by the name"

While opening files with vi editor we come across the following error at times.



The error comes when the the file was not closed cleanly the last time it was opened, and the might done to the while during the last open might not have been saved.

For example when we close the terminal with out Quitting the file, use Cntl+z to close the file or the system shuts down abruptly when the file is open in the editor, in all the these cases vi automatically creates a .swp file of the current open file with the latest contents in it.
The next time we try to open the same file, vi editor realizes that there as swap file present for it and that might be latest file which is required and thus throws this prompt to let the user decide the further course of action.

There are 4 options to choose from

O: Open in read only mode. We can use this to confirm if the file is the latest one or not.
E: If we are not bothered about the lost changes we can directly open it and start editing it.
R: If we want to recover some of the changes that we have failed to save we can choose this option, which will try to recover the last auto saved file.
Q: Quitting with you opening the file
A: Abort the opening of the file and come back to terminal .

After choosing one of the above options and making sure that we have successfully recovered the file, we can prevent vi from throwing the message next time the file is opened we need to remove the swp file using the "rm" command. The swap file name will be ".filename.swp"

Installing xfce on debian

The debian distros by default come loaded with gnome desktop, but with the freedom available in linux that does not prevent us from trying other desktop environments on debian.

One of the popular Desktop Environments XFCE, known to run well is lower hardware configurations. (http://xfce.org)
This can be installed in debian just like installation of any other package.

Open the synaptic package manager search for xcfe4 ( or which ever version is available in the distro) , click on mark for installation and then click on apply.

or Open the terminal and type



Once the installation is done,logout of the the current gnome session.
In the login screen click on the user account for login.

At the bottom center there will be three options, the language, the country and the third the Desktop environment to be used. Click on xcfe and login.
The desktop will boot into the new xfce environment.

Taking Screenshot using gimp

We can use the gimp software to take screen shots just like any other. screen shot sfotware.To take a screen shot open gimp and click on



Screenshot_1 photo 1_screen_shot.jpg

A menu as shown below will pop up.

Screenshot_2 photo 2_screen_shot.jpg

The options available are: 1) Take screenshot of single window: This will allow us the take the screen shot of any of he open window by just clicking on it.
We can choose the ignore the decorations of the window that is the outer peripheral images of the widow by removing the tick mark from the option "Include window Decoration".

2) The second option is used when we want to take the screen shot of the entire screen, that is every thing visible on the desktop.

3)The third option is when we want to choose a specific area of the desktop for the screen shot. On selecting this we will be allowed to choose the area of which we want to take the screen shot.

All the above three options can be coupled with a dealy. That is, in the delay field if we mention "5", then gimp will start taking the action corresponding to your choice only after 5 seconds. For example if we choose "Take screenshot of entire screen and then say 5 as the delay, then after a dealy of 5 seconds which ever window will be open on the screen a screen shot of the same is create.

Once the screen shot has been taken, the same will displayed in the gimp. To save the screenshot click on



we can save the image in any of gimp supported formats i.e. jpg,png,gif etc for later use by adding the corresponding extention to the name or by choosing the file type from the list at he bottom left of the save as window.

 photo 6_save_as.jpg

Thus if we have gimp we really don't need any snap shot taking software at all.


virtual dice on the linux terminal

Here is a script that will act like a dice, a six sided dice, on the terminal.
On running the script, it will display numbers between 1 and 6 randomly, random number of times and at the end settle to one number just as in a usual dice.

dice.sh :



Save the file as dice.sh, and give it execute permission



On executing the script, the terminal will be cleared and in the top center numbers will appear. Which will change a few times and then settle to one number.



If executed with out any arguments the script simulates the normal six sided dice and the maximum number of rolls for the dice is 10 i.e. it will generate between 1 to 10 numbers randomly before settling on the final number.

This can be modified by passing the maximum number required in the dice as the first argument and the maximum number of rolls required in the second argument i.e.



Meaning simulate a dice that has numbers 1-8 and generate 20 random numbers before settling to the final one.

Displaying calendar on linux terminal

We can use the cal command in the linux terminal to display the calendar of the month in the terminal itself.

Example :



 photo cal.png

We can see the calendar of the month with the current date highlighted.

We can avoid highlighting of the current day using the the option -h

 photo cal_2.png

We can also display the calendar of any year we want by passing the option -y followed by the year.

Example:



 photo year_cal.png

We make the calendar weeks to appear in tow using the command ncal



 photo ncal.png


Converting the sharp corners of an image to round corers using gimp in linux

The pictures taken using cameras are always rectangular in shape with sharp corners, so are most of the other images.

We can use gimp to change the images with rectangular corners to round corners. Here are steps to do the same.

Open gimp, and click on



 photo 1_file_open.jpg

Browse to the photo that needs to be transformed and click on open.

 photo 2_image.jpg

Now click on



 photo round_border.jpg

It will prompt a menu as shown below.

 photo round_border_menu.jpg

Edge Radius: Is the radius of the arc at the corners. The bigger the number the bigger the arc will be at the corner.
Add Drop Shadow : We can make the image appear to have a little depth by adding a shadow to the image. The other three options are for the properties of the shadow.

If the main image has to be retained as it is we can click on "work on a copy" so that the gimp creates a new image with round corners.

Now click on OK. Once gimp finishes working on the image, you should see the image as below.

 photo rounded_image.jpg

Click on



 photo 6_save_as.jpg

Give a name for the image and add the extension .jpg.

If prompted for confirmation regarding export to jpg click on export.

 photo 7_export.jpg

The next prompt will allow us to choose the image quality. Choose the required quality and click on save.

 photo 8_save.jpg

The image with rounded corners should be ready as below.

 photo rounded_final.jpg


Addng border to an image using gimp in linux

Here is how we can use gimp to add border to any image. For example to the image below we can add a colored border

 photo DSC00302.jpg

The image with border will look as below.

 photo simpler_border.jpg

The color of the border and the thickness can be configured as given below.
Open gimp, and click on



 photo 1_file_open.jpg

Then browse the image to which the border has to be added and click on open.

 photo 2_image.jpg

The image will open in gimp as a layer. Now click on



 photo 3_border.jpg

A menu as shown below will open.

 photo 4_border_menu.jpg

The first two options are the thickness of the border in the x and y directions respectively.
The third option is to choose the color for the border.

The fourth option allows us to choose the spread of the color. By default the color will be evenly spread, but if a higher number is given here the spread will be uneven with darker at certain places and lighter at the other.

Now click on OK.

Gimp will create the border for the image.

 photo 5_final.jpg

Now to save the image in jpg format, click on

file->save as

In the window that opens Enter a filename, and choose the file type as jpg among the options in the right corner.

 photo 6_save_as.jpg

Click on save,a window will be shown prompting you to confirm if you want to export the image to jpg format. click on export.

 photo 7_export.jpg

In the next window the image quality can be controlled by choosing the appropriate number against the quality and click on save.

 photo 8_save.jpg

The image with the border should be ready.