Category Archives: GNOME

Set BING Background as your Desktop Wallpaper in GNOME


BING comes up with a beautiful background everyday. I thought why not set this background as my desktop wallpaper. But it would be a cumbersome task to set it manually. So I searched (Googled, BINGed) for some script which will do this for me. I found BING Downloader which does this task on Windows. I could not find any such script for GNOME. So, I thought of writing one.

I wrote a script which when executed automatically sets the GNOME wallpaper as BING background of the day. This is a PHP script. To execute this script you need to have php installed on your system. You can install php in Ubuntu as

sudo apt-get install php5 php5-cli

Now you are all set to download this script. Download Link: http://www.spsneo.com/scripts/bing_wallpaper.tar.gz

Download this file, extract the script file. Now you can run the script from terminal :
php bing_wallpaper.php

And your wallpaper is set. You can run this script daily from your terminal or you can set a cron job for the same or you can set up an icon in your gnome panel for this script.

I will keep updating this script. And I am also planning to write the same script in python. So check back again if you dont want to install php on your system.

Send your feedbacks and suggestions.

Update 1: I have modified the script to work with http proxy. Just assure that the environment variable http_proxy is properly set.

Update 2: Modified the script to keep the image centered on the desktop with black background. Try it out.

Open any file from terminal in Gnome


I normally use terminals to navigate through directories in my computer. I often have to remember the executable filename of different applications to open files. Like to open a pdf file I have to remember evince, for an audio or video file – vlc. But its really difficult to remember executable filenames for all types of files. For example I don’t remember how to open a .xls file from command line.

There’s a command which open files using GNOME file handlers – “gnome-open”. Now, when I have to open any file I just type in “gnome-open <filename>”. Simple !

To make things more simple I have made an alias ‘go’ for ‘gnome-open’. Now opening a file from terminal is as easy as typing “go <filename>” in terminal.

Random Wallpapers in Gnome


There are many softwares in Windows(TM) which changes the wallpaper randomly from a given set of images. I was thinking of this for my Linux machine. I came up with a shell script. Though there can be many other ways. I just wanted to share my script and nothing else.

Update: There’s a tool which does all this automatically. drapes in Universe repository

Here in this code I am assuming that you have got all your wallpaper images in the directory /home/username/Pictures . You have to replace this directory with your wallpaper directory.

Here goes the code :

#! /bin/bash
wallpaper_folder=/home/username/Pictures
wallpaper_array=($wallpaper_folder/*.jpg)
number=${#wallpaper_array[*]}
((number=RANDOM%number))
random_wallpaper=${wallpaper_array[$number]}
gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$random_wallpaper"

Well, so let us quickly analyze the code. First line is the famous ‘sha-bang’.

In the second line I am just setting the path of the wallpaper folder to the variable wallpaper_folder.

Third line I am creating an array containing all the file names with the extension jpg in the directory ‘wallpaper_folder’ (spaces are being escaped). More about bash arrays here.

Fourth line, I am calculating the number of elements in the array. This is the standard method of calculating the number of elements in a bash array. (replacing # with @ will also work fine).

Then in the fifth line, random number is generated within the range 0 to ‘number’. More about random numbers in bash here.

Sixth line set the variable random_wallpaper to the value corresponding to the key ‘number’ in the array wallpaper_array.

Seventh line, finally sets the file ‘random_wallpaper’ as the wallpaper. gconftool-2 is used to do customization in GNOME settings. Check out the man pages of gconftool-2 to know more about it. There’s a GUI tool for this gconftool-2 : gconf-editor

Now this script just sets the wallpaper randomly from a given set of images. Now you can schedule this script using cron to execute it at some regular interval. (In case you dont know what is cron, check out the manual pages of cron and crontab).

Gedit : A Powerful Light-Weight IDE


Gedit can be transformed into a powerful light-weight IDE.

Before I tell you the steps take a look at the screenshot of my gedit:

gedit IDE

Now, if you are convinced that you also want to customize gedit read on …..

Step 1: Go to edit->Preferences and tick the options :

  • Display line numbers
  • Highlight current line
  • Highlight matching bracket

Step 2:  Click the ‘Editor’ tab in the preferences dialog box. Tick the option :

  • Enable Automatic indentation
  • [optional] change tab width to 4 or whatever width you think is appropriate for you.

Step 3: Download the darkmate theme : http://grigio.org/files/darkmate.xml Save the xml file on your desktop. Click the ‘Font & Colors’ tab in the Preferences dialog box. Click the Add button and then add the xml file downloaded just now. Darkmate theme should now be in the list of Color Scheme. Select the Darkmate theme. Or you can select any Color Scheme you like. You can get more themes from http://live.gnome.org/GtkSourceView/StyleSchemes

Step 4: Now install the package gedit-plugins . This can be accomplished by

$ sudo aptitude install gedit-plugins

(in Debian based system)

or

$ su

# yum install gedit-plugins

(in rpm based system)

After installing the gedit-plugins package open the tab ‘Plugins’ in the Preferences dialog box.

Tick the following plugins:

  • Bracket Completion – This will automatically print right brackt/parantheses for every left counterpart.
  • Code Comment – This plugin helps you in commenting a block of code
  • [optional] Color Picker – This is helpful for web designers to get the color code.
  • Draw Spaces – This plugin will draw an arrow for every tab and one dot for every space. You can configure the color of the space or tab by clicking the “Configure Plugin”
  • Embedded Terminal – This will embed a gnome-terminal at the bottom of your gedit window.
  • Execute Tools
  • File Browser Pane
  • Indent Lines – This plugin helps you in indenting a block of code.
  • Session Saver – This plugin helps you save different sessions.

You can check out other plugins according to your need.

Step 5 : You can get more gedit plugins like “Word Completion” and many more useful 3rd party plugins on this page – http://live.gnome.org/Gedit/Plugins

Download whatever plugin you wish and just place the extracted files in ~/.gnome2/gedit/plugins

You are done !

P.S: Please let me know if you find a useful plugin for gedit.