Professional Documents
Culture Documents
to
Customizing the Graphics
in
Grub, Usplash, Xsplash
and GDM
Towheed Mohammed
A Comprehensive Guide to Customizing the
Graphics in Grub, Usplash, Xsplash and GDM.
Copyright © 2010 Towheed Mohammed
Permission is granted to redistribute electronically the unmodified and complete PDF file containing
this guide. The author reserves the right to modify the contents of this guide at any time without prior
notifications to users of this guide. The PDF file comprising this guide or any part thereof may not be
altered, edited, modified, published, printed (except where such printing is for the users personal use
only), sold or offered in exchange for any type of compensation whether such compensation be
monetary or otherwise without the prior written permission of the author.
This guide is distributed with the hope that it will beneficial to users of this guide. While every effort
has been made to ensure the accuracy of the contents of this guide, the author of this guide shall not be
held liable to anyone whomsoever, for any damages whatsoever caused from the use of this guide,
whether such damages be consequential or otherwise.
This guide is distributed without any warranties, whether such warranties are implied or expressed.
DISCLAIMER:
The procedures outlined below have been tested ONLY on Karmic. There is no guarantee that they will
work on other versions of Ubuntu. If you decide to test on other versions, YOU DO SO AT YOUR
OWN RISK. A lot of the customization is carried out at the command line and involves directly
modifying system files. Of course, we all know the dangers associated with such actions, so if your
system gets screwed, refuses to boot, catches afire, runs away or goes to sleep and never wakes up
again, DO NOT BLAME ME. You have been FOREWARNED.
INTRODUCTION
In my quest to fully customize the graphics in Ubuntu 9.10 (Karmic Koala) starting from the Grub
menu and working my way up to the desktop I've found bits and pieces of informations scattered
throughout the Internet and on forums dedicated to Ubuntu. Most of these were not geared towards
people new to Karmic and a lot of the customization were not thorough enough. I wanted to do a lot
more than what was given. This is when I decided to test the waters of customizing Karmic. The
learning curve was very steep because I am also a beginner to Karmic and Linux on the whole. I
decided to put everything I've learnt into what I hope will be a very comprehensive guide on
customizing the graphics screens of Karmic starting from the Grub menu.
This guide is written for beginners and so the more experienced users may find it a bit repetitive. Some
may even say that there are programs available that allows you to do the customizations easily, but I've
found that such programs just scratches the surface of what's possible.
Throughout this document, whenever I backup files, I append '_orig' to the original names. This
applies to both files and directories. You may rename them whatever you like but, please try to be
consistent.
Gedit is used as the text editor throughout this document but, if you are more comfortable using another
editor then please do.
The different graphic screens during the bootup sequence are shown in this order:
grub => usplash => xsplash => gdm (login screen) => xsplash => desktop
I will go through the procedures for customizing each of these, starting with Grub.
BTW, the graphics are meant to educate not entertain, so please.
Start by opening a Terminal window. Click on Applications => Accessories => Terminal. Most of the
commands that's used start with the sudo command. Sudo runs a command with root privileges. For
more information on sudo, open the Ubuntu Help Center and type 'man sudo' in the search box or have
a look at the following links:
http://ubuntuforums.org/showthread.php?t=261204
http://ubuntuforums.org/showthread.php?t=723263
http://ubuntuforums.org/showthread.php?t=292094
http://en.wikipedia.org/wiki/Sudo
GRUB
The procedure listed below changes the Grub menu colors and adds a background image (Grub
wallpaper). It was tested on Grub 1.97~beta4 ONLY.
First, backup the files that will be modified. The three files that will be modified are:
1. /etc/grub.d/05_debian_theme
2. /etc/grub.d/00_header, and
3. /etc/default/grub
Enter the following commands in the Terminal window:
sudo cp /etc/grub.d/05_debian_theme /etc/grub.d/05_debian_theme_orig
sudo cp /etc/grub.d/00_header /etc/grub.d/00_header_orig
sudo cp /etc/default/grub /etc/default/grub_orig
To revert to the original files, enter the following commands:
sudo cp /etc/grub.d/05_debian_theme_orig /etc/grub.d/05_debian_theme
sudo cp /etc/grub.d/00_header_orig /etc/grub.d/00_header
sudo cp /etc/default/grub_orig /etc/default/grub
Changing the menu colors
The text colors for Grub's menu are specified in the 05_debian_theme file. Open this file for editing
with gedit:
gksudo gedit /etc/grub.d/05_debian_theme
Locate the following two lines at the beginning of the file:
set menu_color_normal=white/black
set menu_color_highlight=black/white
The color format is: foregroundcolor/backgroundcolor. For a list of possible colors that can be used,
have a look at:
http://www.gnu.org/software/grub/manual/html_node/color.html#color
To set the menu colors to display green text on a black background and have it reversed for the
highlighted item in the menu, edit the above two lines:
set menu_color_normal=green/black
set menu_color_highlight=black/green
Save the changes and exit gedit. Grub must be updated for the changes to take effect. Enter this
command in the Terminal window:
sudo updategrub
This updates the /boot/grub.cfg file. Reboot to see the new menu colors. Here's a screenshot of what it
looks like:
Screenshot 1: Grub's Menu Color
Notice that Grub's title and help text are still white. To change their colors, the 05_debian_theme file
must be edited again. Open the file for editing:
gksudo gedit /etc/grub.d/05_debian_theme
Add the following line beneath the set menu_color_highlight line:
set color_normal=green/black
The beginning of the /etc/grub.d/05_debian_theme file should now look something like this:
set_mono_theme()
{
cat << EOF
set menu_color_normal=green/black
set menu_color_highlight=black/green
set color_normal=green/black
EOF
}
Save the changes and exit gedit. Update Grub to reflect the changes:
sudo updategrub
Reboot to see the changes.
Now that we can change the menu colors, let's add a background image.
Adding a background image
A background image can be added to Grub's menu. Grub does not scale the background image to fit
the screen, so the image used should be the same dimension as the screen's dimension set by Grub.
Grub's default screen dimension is 640x480 so the image used should have this dimension also.
There are several ways of setting the background image for Grub's menu. The simplest way is to copy
either a PNG image to /usr/share/images/desktopbase/ and rename it moreblueorbitgrub.png or
copy a TGA image to the same directory and rename it moreblueorbitgrub.tga. Remember, this
image should be a 640x480 image.
sudo cp ~/Documents/mygrubimage.png /usr/share/images/desktopbase/moreblueorbitgrub.png
for i in {/boot/grub,/usr/share/images/desktopbase}/moreblueorbitgrub.{png,tga} ; do
The directory containing the image is added to the above line. Assuming that the name of the directory
is /home/towheed/Documents/images:
for i in {/boot/grub,/usr/share/images/desktop
base,/home/towheed/Documents/images}/moreblueorbitgrub.{png,tga} ; do
for i in {/boot/grub,/usr/share/images/desktop
base,/home/towheed/Documents/images}/shaded.{png,tga} ; do
Remember, the dimensions of the image file should be 640x480.
Update Grub to reflect the changes.
sudo updategrub
Reboot to see the new background.
Setting Grub's video mode
Grub can use images of different dimensions for its background, but first, it must be told what video
mode to use. Grub may not necessarily support all of the video modes of a particular graphics adapter.
To determine which modes Grub support, follow this simple procedure:
1. Reboot
2. When the Grub menu shows, press 'c' to go to the Grub command line. Your prompt
should be 'sh.grub>'.
3. At the prompt type vbeinfo. A list of video modes will be displayed.
4. Take note of the mode you would like to use, i.e.: 1024x768, 1280x1024 etc.
5. Press <ESC> to return to the menu.
6. Boot your menu choice and continue from below.
Open the file /etc/default/grub for editing:
gksudo gedit /etc/default/grub
Locate this line:
#GRUB_GFXMODE=640x480
The hash (#) symbol indicates this line is a comment. Uncomment the line by deleting the hash and
replace the 640x480 with the mode that you noted in Step 4 above. If 1024x768 was chosen, the line
should look like this:
GRUB_GFXMODE=1024x768
Grub will now use this video mode and an image this size can now be used for the background.
When finish editing, save the file, close gedit and update Grub. Reboot to see the menu in the new
video mode.
gksudo gedit /etc/grub.d/00_header
Locate the following line:
set gfxmode=640x480
and change it to:
set gfxmode=${GRUB_GFXMODE}
Save the file, close gedit, update Grub and reboot.
Changing the menu colors when a background is set
Grub can be set to use a different menu color when a background image is displayed. This allows for a
more consistent color scheme in Grub's menu. Open the /etc/grub.d/05_debian_theme file for editing
and locate the following lines:
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
set color_normal=black/black
set color_highlight=magenta/black
else
Change the menu colors to display blue text on a black background and reverse it for the selected item:
if background_image `make_system_path_relative_to_its_root ${bg}` ; then
set color_normal=blue/black
set color_highlight=black/blue
else
Save the changes, exit gedit and update Grub to reflect the changes.
NOTE: Whenever we modify these files (or any of Grub's configuration files) we must update Grub
for the changes to take effect.
For those interested in customizing other aspects of Grub take a look here:
http://ubuntuforums.org/showthread.php?t=1195275&highlight=add+menu+entries+grub
XSPLASH
If you intend to create images for xsplash, then it is highly recommended that you become fluent in the
use of gimp of a similar graphics image editor.
Ubuntu's default xsplash screen looks like this:
Screenshot 2: Default Xsplash Screen
The xsplash screen consists of three elements:
1. The background image
2. The Ubuntu logo
3. The throbber (the horizontal bar beneath the logo)
sudo cp r /usr/share/images/xsplash/ ~/Documents/xsplash_orig/
To restore the original xsplash files, enter:
sudo cp r ~/Documents/xsplash_orig/ /usr/share/images/xsplash/
XSplash Background
The image to be used for the background can be any dimension because it will be scaled to fit the
screen. Keep in mind though, an image that's larger than the screen's dimension will look better when
scaled down to fit the screen than one that's smaller and scaled up. Here are some screenshots using
images of different dimensions:
Screenshot 3: Xsplash Background at 400x300 (scaledup to 640x480)
Screenshot 4: XSplash Background at 640x480 (no scaling)
Screenshot 5: XSplash Background at 1024x768 (scaleddown to 640x480)
The filename for the background image is bg_2560x1600.jpg. The background is changed by copying
the new background image file to this file. Assuming the new image file is stored in the Documents
directory and named myxsplash.jpg, enter:
sudo cp ~/Documents/myxsplash.jpg /usr/share/images/xsplash/bg_2560x1600.jpg
To see the new xsplash background, enter:
sudo xsplash
To hide the background image, either delete the image file or simply rename it.
To delete the file:
sudo rm /usr/share/images/xsplash/bg_2560x1600.jpg
To rename it (assuming the new filename is bg_2560x1600.jpg_noshow), enter (on one line):
sudo mv /usr/share/images/xsplash/bg_2560x1600.jpg
/usr/share/images/xsplash/bg_2560x1600.jpg_noshow
NOTE: If the background image is hidden so too will elements 2 and 3 above.
HINT: Other image formats can be used for the background without first converting it to the JPG
format. Simply change the filename's extension to jpg. It was tested with PNG ad SVG
images.
XSplash Logo
There are four files of different dimensions that's used for the xsplash logo, these are:
Xsplash displays one of the above depending on the screen's width. For example, if the screen's width
is 1280, xsplash will use the logo_medium.png file. The logo is changed by copying the new logo file
to this file.
Assuming the new logo is stored in the Documents directory and named mylogo.png and the screen's
width is 1280 pixels, enter:
sudo cp ~/Documents/mylogo.png /usr/share/images/xsplash/logo_medium.png
To test the new logo, enter:
sudo xsplash
The logo can be any dimension because xsplash does not scale it as it does with the background image.
Here are some screenshots with logos of different dimension.
Screenshot 6: XSplash logo at 400x200
Screenshot 7: XSplash logo at 800x400
Of course, making the logo larger than the screen's dimension may not make much sense. Notice how
the sides and top of the logo in this screenshot have been cropped.
Screenshot 8: XSplash logo at 1024x500 (sides and top are cropped)
To hide the logo, either delete or rename the appropriate logo file.
HINT: Other image formats can be used for the logo without first converting it to the PNG format.
Simply change the files's extension to .png. It was tested only with JPG images.
Accurately placing the logo
The logo is placed on the screen according to the following formula:
left_edge_of_logo = screen_width/2 logo_width/2
top_edge_of_logo = screen_height/3 logo_height/2
XSplash Throbber
The throbber is the animated bar that's displayed just below the logo. There are four files of different
dimensions that's used for the xsplash throbber, these are:
The throbber file is a bit more involved than either the background or logo images. The throbber file is
an animated PNG file which consist of 50 frames, all the same height. This gives the throbber file a
dimension of:
throbber_height = frame_height x 50
throbber_width = any width we choose
NOTE: The frame height is the height of the displayed throbber.
The frames are sequenced vertically starting from Frame 1 at the top. XSplash animates the throbber
by displaying the frames sequentially, i.e.:
Frame 1
Frame 2
.
.
.
Frame 49
Frame 50
Here are some screenshots of different throbbers.
Screenshot 9: Throbber created with throbber_xtra_large_redyel.png
Screenshot 10: Throbber created with throbber_circle.png
Screenshot 11: Throbber created with throbber_xtra_large_2550.png
The files used to create the throbbers in the above screenshots have been included in the downloaded
tar file. Let's create the throbber shown in Screenshot 9. Assuming the file was extracted to the
Documents directory and the screen's width is 1280 pixel, enter (on one line):
sudo cp ~/Documents/throbber_xtra_large_redyel.png
/usr/share/images/xsplash/throbber_medium.png
To test the new throbber, enter:
sudo xsplash
HINT: To hide the throbber, either delete or rename the appropriate throbber file.
Accurately placing the throbber
The throbber is placed on the screen according to the following formula:
left_edge_of_throbber = screen_width/2 throbber_width/2
top_edge_of_throbber = screen_height/3 + logo_width/2 + throbber_height/((throbber_frames1) x2)
Now, let's really get down and dirty with . . .
ADVANCED XSPLASH
XSplash is displayed twice during the boot/login process. The first xsplash is shown right after
usplash, while the second one is displayed after entering your login credentials but before the desktop is
shown. It is possible to customize these two xsplash screens independently. But before that is done,
let's go through some advance xsplash basics.
Background Image
Locate an image for the background (try a different image from the bg_2560x1600.jpg image).
Assuming the new image is located in the Documents directory and named mynewbkgnd.jpg, enter:
sudo xsplash background ~/Documents/mynewbkgnd.jpg
Notice that the new image is now the xsplash background. This is not a permanent change however and
if sudo xsplash was entered in the terminal window the regular xsplash background would be shown.
Logo Image
The same applies for the logo image. Assuming the new logo is in the Documents directory and named
mynewlogo.png, enter:
sudo xsplash logo ~/Documents/mynewlogo.png
Again, this change is not permanent.
Throbber Image
Well, it should be obvious by now, to change the throbber, enter:
sudo xsplash throbber ~/Documents/mynewthrobber.png
To have the throbber reverse directions (go back and forth), enter:
sudo xsplash throbber ~/Documents/mynewthrobber.png pingpong
It was mentioned earlier that the throbber file must consist of 50 frames. Well, quite frankly, with
advanced xsplash this is not so. The throbber can be designed with as many frames as desired (within
reason of course). Assuming the new throbber has 500 frames, enter:
sudo xsplash throbber ~/Documents/mynewthrobber.png frames 500
Let's demonstrate further how the frames commandline parameter affects the appearance of the
throbber. Using the included throbber_xtra_large_2550.png file, enter:
sudo xsplash throbber ~/Documents/throbber_xtra_large_2550.png
Now enter:
sudo xsplash throbber ~/Documents/throbber_xtra_large_2550.png frames 150
Noticed the difference?
Timeout
To control how long xsplash is displayed for, enter:
sudo xsplash timeout 5
This shows xsplash for 5 seconds.
For more command line arguments, enter:
sudo xsplash helpall
Customizing the XSplash screens
Let's backup the entire directory containing the files that will be edited, enter:
sudo cp r /etc/gdm/ ~/Documents/etc_gdm_orig/
And to restore it, enter:
sudo cp r ~/Documents/etc_gdm_orig/ /etc/gdm/
Customizing the first Xsplash screen
gksudo gedit /etc/gdm/Init/Default
At the beginning of the file, locate these lines:
if [ x '/usr/bin/xsplash' ];
then
/usr/bin/xsplash gdmsession daemon
fi
Any or all of the xsplash elements can now be changed for this xsplash screen by adding the different
commandline parameters to the third line. For example, to display a custom background, custom logo
and custom throbber consisting of 500 frames for 10 seconds, edit the third line as follows:
/usr/bin/xsplash gdmsession daemon background /dir/backgroundimage logo
/dir/logoimage throbber /dir/throbberimage frames 500 –timeout 10
NOTE: The /dir/ path must be an absolute path here, ie: /home/<username>/Documents/ and not
~/Documents/.
HINT: This xsplash will also be shown during logout.
Customizing the second Xsplash screen
gksudo gedit /etc/gdm/PreSession/Default
Now add the commandline arguments (as above) to the /usr/bin/xsplash daemon line.
Customizing the second Xsplash screen for each user
It is possible to customize the second xsplash screen for each user of the computer. First, create a new
file named .xsplash_custom in your home directory, enter:
gedit ~/.xsplash_custom
Now add the following lines:
#!/bin/sh
# Customize the second xsplash for users.
# To specify a custom logo, add logo filename
# To specify a custom background, add background filename
# To specify a custom throbber, add throbber filename
# To specify the number of frames in the throbber, add frames frames
# To have the throbber reverse direction, add pingpong
# To display xsplash for a specified time, add timeout seconds
# eg /usr/bin/xsplash daemon background filename logo filename
# throbber filename frames xx –pingpong timeout seconds
/usr/bin/xsplash daemon
Save the file and close gedit. The file must now be made executable, enter:
chmod +x ~/.xsplash_custom
Next, copy this file to the home directory of each user of the computer. Enter (replace username with
the respective user's username):
sudo u username cp ~/.xsplash_custom /home/username/
Repeat for each user.
Each user can now customize the second xsplash screen (as detailed above) by editing this file.
Second, open the /etc/gdm/PreSession/Default file for editing:
gksudo gedit /etc/gdm/PreSession/Default
At the beginning of the file, locate these lines:
if [ x '/usr/bin/xsplash' ];
then
/usr/bin/xsplash gdmsession daemon
fi
The third line may be different if the file was previously edited as detailed above.
Edit the file by adding the following highlighted lines:
if [ x '/usr/bin/xsplash' ];
then
if [ x $HOME/.xsplash_custom ];
then
$HOME/.xsplash_custom
else
/usr/bin/xsplash daemon
fi
fi
The source code for xsplash is here:
http://bazaar.launchpad.net/~xsplashteam/xsplash/trunk/annotate/head%3A/src/xsplash.c
GDM (LOGIN SCREEN)
Despite popular beliefs, gdm (the login screen) is highly customizable. The configuration information
for the login screen is stored in a gconf database. For further information on gdm please visit
http://library.gnome.org/admin/gdm/stable/overview.html.en .
A brief description of the gconf database
A gconf database is a database system that stores preferences for applications. The preferences are
stored as keyvalue pairs defined by a schema file for the particular application. The schema files are
located in /usr/share/gconf/schemas/. Each section of the schema file defines a key, it's datatype,
default value, a description of the key, among others. For example, information on the desktop's
background is stored in the desktop_gnome_background.schemas file.
The format of the command we will use for changing the value of a keyvalue pair is:
sudo u gdm gconftool2 type <datatype> set key <value>.
With this information at hand, let's start the customization of the login screen.
Background Image
Gdm's default background image is the same as Xsplash's default background image, ie:
/usr/share/images/xsplash/bg_2560x1600.jpg. If the xsplash background image is replaced by changing
this file, you will notice that the background image of the login screen also changes to this new image.
It follows therefore, that a simple method of changing the background image of the login screen is to
change the bg_2560x1600.jpg file. The disadvantage of this is it does not allow different background
images to be used for xsplash and gdm, unless of course, the xsplash background image was changed as
detailed under Advanced Xsplash.
The gconf database must be used to specify a different background image for gdm. The name of the
gdm background image is stored in the /desktop/gnome/background/picture_filename key of the gconf
database. To change the background image, enter (as one line):
sudo u gdm gconftool2 type string set /desktop/gnome/background/picture_filename
"/dir/filename"
NOTE: The directory specified by dir must be specified as an absolute path and the filename must
include the file's extension.
The scaling method used to draw the background image on the screen is specified by the
/desktop/gnome/background/picture_options key. Possible values for this key are: none, zoom,
stretched, scaled and centered.
If the background image is smaller than the screen's dimension and is to fill the screen (while
maintaining its aspect ratio), enter:
sudo u gdm gconftool2 type string set /desktop/gnome/background/picture_options "zoom"
Logout to see the changes.
To hide the background image, set the value of the picture_filename key to an empty string, ie:
sudo u gdm gconftool2 type string set /desktop/gnome/background/picture_filename ""
If the background image is hidden, a brown background color is shown at the gdm screen. This not an
image but rather a color that's used for the background. This color is set by three keys in the gconf
database. These keyvalue pairs are as follows:
Key Values
/desktop/gnome/background/color_shading_type solid
horizontal_gradient
vertical_gradient
/desktop/gnome/background/primary_color RGB Color Value (#rrggbb)
/desktop/gnome/background/secondary_color RGB Color Value (#rrggbb)
Using a solid color for the background
Before a solid color is set for the background, the background image must be hidden, the
color_shading_type is set to solid and finally the background color is specified by the primary_color.
The specified color should be in the format: #rrggbb, where rr, gg and bb are the hexadecimal values
for the red, green and blue colors respectively. To set a solid background color of 50% gray, enter the
following commands:
sudo u gdm gconftool2 type string set /desktop/gnome/background/picture_filename ""
sudo u gdm gconftool2 type string set /desktop/gnome/background/color_shading_type "solid"
sudo u gdm gconftool2 type string set /desktop/gnome/background/primary_color "#7F7F7F"
HINT: To translate a color to it's hexadecimal value, use the color selection dialog of any
application that has it, or use the colorbox application included in the downloaded tar file.
Using a horizontal gradient for the background
To set a horizontal gradient for the background, the background image must be hidden, the
color_shading_type is set to horizontal_gradient, the left (start) color is specified by the primary_color
and the right (end) color is specified by the secondary_color. To set a horizontal gradient going from
50% red to 100% blue, enter the following commands:
sudo u gdm gconftool2 type string set /desktop/gnome/background/picture_filename ""
sudo u gdm gconftool2 type string set /desktop/gnome/background/color_shading_type
"horizontal_gradient"
sudo u gdm gconftool2 type string set /desktop/gnome/background/primary_color "#7F0000"
sudo u gdm gconftool2 type string set /desktop/gnome/background/secondary_color "#0000FF"
Using a vertical gradient for the background
To set a vertical gradient for the background, the background image must be hidden, the
color_shading_type is set to vertical_gradient, the top (start) color is specified by the primary_color
and the bottom (end) color is specified by the secondary_color. To set a vertical gradient going from
100% green to 100% yellow, enter the following commands:
sudo u gdm gconftool2 type string set /desktop/gnome/background/picture_filename ""
sudo u gdm gconftool2 type string set /desktop/gnome/background/color_shading_type
"vertical_gradient"
sudo u gdm gconftool2 type string set /desktop/gnome/background/primary_color "#00FF00"
sudo u gdm gconftool2 type string set /desktop/gnome/background/secondary_color "#FFFF00"
NOTE: If a background image with transparent areas is used and any of the above color shading is
set, then these colors will show through the transparent areas in the image. This may or
may not be a desirable effect.
HINT: The above colors can also be specified using the color's name ie: red, green blue, yellow
pink etc. The color names are listed in the /etc/X11/rgb.txt file. For further information on
RGB to color names, look at these online resources:
http://web.njit.edu/~kevin/rgb.txt.html
http://www.tx4.us/moacolor.htm
http://en.wikipedia.org/wiki/X11_color_names
http://en.wikipedia.org/wiki/List_of_colors
http://www.xfree86.org/current/X.7.html#sect10
Hiding both the background image and color
The drawing of both the background image and color shading can be disabled by changing the value of
the /apps/gdm/simplegreeter/settingsmanagerplugins/background/active key. The datatype for this
key is bool (boolean) and the key's value can be either true or false.
To disable the drawing of both the background image and color, enter:
sudo u gdm gconftool2 type bool set /apps/gdm/simplegreeter/settingsmanager
plugins/background/active false
To enable the drawing of both the background image and color, enter:
sudo u gdm gconftool2 type bool set /apps/gdm/simplegreeter/settingsmanager
plugins/background/active true
Logout twice for this setting to take effect.
SimpleGreeter (Login Window)
Most of the indepth explanation will be skipped from now on as they should be obvious at this point.
Also, most of the changes from this point on may require us to logout or restart twice before they take
effect. Let's backup the directories containing the files to be modified:
sudo cp r /usr/share/gdm/ ~/Documents/usr_share_gdm_orig/
sudo cp r /usr/share/icons/HumanLoginIcons/ ~/Documents/HumanLoginIcons_orig/
sudo cp r /usr/share/themes/Humanlogin ~/Documents/HumanLogin_orig/
The screenshot below shows some elements of the simplegreeter.
Screenshot 12: SimpleGreeter
Face Browser
Let's begin the customization of the simplegreeter by changing the users images in the face browser.
The gnomeaboutme application is used to add or change the user's face image in the face browser.
Open gnomeaboutme by clicking:
System => Preferences => About Me
Next click on the image icon (see the screenshot below) and select an image from the 'Select Image'
dialog. The selected image is inserted into the image icon. This creates a file named .face in the user's
home directory. Each user can do this to create a face image in the face browser.
Screenshot 13: gnomeaboutme dialog
Another method of creating a face image is to manually create a file named ~/.face:
cp /dir/faceimage ~/.face
If we do this however, the face image in gnomeaboutme never gets updated. This method can also be
used to manually create face images for other users of the computer. In the following command replace
username with the user's username:
sudo u username cp /dir/faceimage /home/username/.face
If this is done, the user must login before the face image in the face browser gets updated.
NOTE: There is a confirmed bug in gnomecontrolcenter with respect to how the face browser
works. For a description of the bug report see:
https://bugs.launchpad.net/ubuntu/+source/gnomecontrolcenter/+bug/525144
Screenshot 14: Face Images
The user list in the face browser can be disabled. If it is disabled, users are required to enter both their
username and password to login. The user list is disabled by setting the /apps/gdm/simple
greeter/disable_user_list key to true:
sudo u gdm gconftool2 type bool set /apps/gdm/simplegreeter/disable_user_list true
HINT: The user list cannot be disabled if automatic login is enabled.
Computer Icon
The simplegreeter window uses the HumanLoginIcons as its default icon theme. The default computer
icon is defined by the /usr/share/icons/HumanLoginIcons/apps/64/computer.png file. The simplest
method of changing the computer icon is to copy the new icon to this file. Set the computer icon to the
facecool.svg icon from the gnome icon theme:
sudo cp /usr/share/icons/gnome/scalable/emotes/facecool.svg
/usr/share/icons/HumanLoginIcons/apps/64/computer.svg
sudo cp /usr/share/icons/gnome/scalable/emotes/facecool.svg
/usr/share/icons/HumanLoginIcons/apps/64/
sudo u gdm gconftool2 type string set /apps/gdm/simplegreeter/logo_icon_name "facecool"
HINT: A 64x64 icon renders the best, but the icon can be any size (it will be scaled accordingly).
An SVG file looks the best though.
Screenshot 15: New Computer Icon
Button Icons
The button icons are disabled by default. To show the button icons, enter:
sudo u gdm gconftool2 type bool set /desktop/gnome/interface/buttons_have_icons true
Screenshot 16: Button Icons
NOTE: This only works for buttons that use stock button images. The icon on the 'Login' button is
set by the icon theme which will be dealt with later.
Banner Message
The banner message is a block of text that's displayed just above the face browser and is disabled by
default. The text displayed is set by the /apps/gdm/simplegreeter/banner_message_text key and is
enable or disabled by the apps/gdm/simplegreeter/banner_message_enable key. To set the text and
display it, enter (text is the message displayed):
sudo u gdm gconftool2 type string set /apps/gdm/simplegreeter/banner_message_text "text"
sudo u gdm type bool set /apps/gdm/simplegreeter/banner_message_enable true
Screenshot 17: Banner Message
If the user list is disabled, the banner message is set using the /apps/gdm/simple
greeter/banner_message_text_nochooser key. To set the text and display it with the user list disabled,
enter (text is the message displayed):
sudo u gdm gconftool2 type string set /apps/gdm/simplegreeter/banner_message_text_nochooser
"text"
sudo u gdm type bool set /apps/gdm/simplegreeter/banner_message_enable true
Screenshot 18: Banner Message with user list disabled
Icon Theme
The default icon theme used by GDM is the HumanLoginIcons. This icon theme is not only used by
the simplegreeter window but is also used for the icons in the panel. Icon themes are located in
separate directories under the /usr/share/icons directory. As shown previously with the computer icon,
the simplest way to change the icons is to replace them with different icons. The icons and there
respective icon files are:
Icons Icon File
Shutdown (Power) systemshutdown.png
Accessibility preferencesdesktopaccessibility.png
Keyboard preferencesdesktopkeyboard.png
Languages preferencesdesktoplocale.png
Session sessionproperties.png
Log In gohome.png
A more elegant method of changing the icons is to use a different icon theme. This by done by
changing the value of the /desktop/gnome/interface/icon_theme key. To change the icon theme to the
Humanity icon theme, enter:
sudo u gdm gconftool2 type string set /desktop/gnome/interface/icon_theme "Humanity"
NOTE: For the icons to show properly, the icon theme must conform to the XDG icon naming
specification. For more on this, take a look at these online resources:
http://standards.freedesktop.org/iconthemespec/latest/index.html
http://standards.freedesktop.org/iconnamingspec/latest/
HINT: Only system themes can be used as icon themes. ie.: themes in a directory under the
/usr/share/icons directory. User themes, ie.: themes in a directory under the ~/.icons/
directory cannot be used. However, user themes can be made into system themes by
copying them to the /usr/share/icons directory. For example, if a user has an icon theme
named myicontheme, to make it a system theme, enter:
sudo cp r ~/.icons/myicontheme/ /usr/share/icons/myicontheme/
Gtk+ Theme
The Gtk+ theme controls the appearance of various elements of the simplegreeter window, including
(but not limited to) the window decorations (borders, titlebar, titlebar buttons), window background,
controls and various other foreground and background colors. Some really extensive themes may also
specify fonts, mouse pointers etc. The dafault Gtk+ theme used by the simplegreeter window is the
HumanLogin theme. The Gtk+ themes are located in directories under the /usr/share/themes/
directory. The easiest way to change the Gtk+ theme is by changing the values of several keys in the
Gconf database. To change the Gtk+ theme to the New Wave theme, enter:
To change the appearance of the controls and the window background:
sudo u gdm gconftool2 type string set /desktop/gnome/interface/gtk_theme "New Wave"
To change the window decoration:
sudo u gdm gconftool2 type string set /apps/metacity/general/theme "New Wave"
Screenshot 19: Using the New Wave Theme
A different theme can be used for the window decorations than that used for the controls and window
background. To change the theme for the window decorations to AgingGorilla and the theme used for
the controls and window background to New Wave, enter:
sudo u gdm gconftool2 type string set /desktop/gnome/interface/gtk_theme "New Wave"
sudo u gdm gconftool2 type string set /apps/metacity/general/theme "AgingGorilla"
Screenshot 20: Using the AgingGorilla Theme for the Window Decorations
The fonts used for displaying text in the controls and the titlebar can also be changed. The format for
specifying a font is:
font_family font_style font_size
To change the font used for displaying text in the controls to Sawasdee set to 10pt, enter :
sudo u gdm gconftool2 type string set /desktop/gnome/interface/font_name "Sawasdee 10"
To change the font used for displaying text in the titlebar to Bold Purisa set to 12pt, enter:
sudo u gdm gconftool2 type string set /apps/metacity/general/titlebar_font "Purisa Bold 12"
Screenshot 21: Changing the fonts
The colors of the following eight items can also be made different from those specified in the selected
theme:
Notice that the value for an item has two parts. A keyword describing the item followed by the RGB
Color Value for the item. Again, the color value may be specified by the hexadecimal value (#rrggbb)
or the color name from the /etc/X11/rgb.txt file.
.../gtk_color_scheme "fg_color: color_value<LF>bg_color: color_value<LF>...
<LF>tooltip_bg_color: color_value"
NOTE: In the following command, <Press Enter> means exactly that, press the <ENTER> key.
After pressing the <Enter> key the first time, the shell prompt changes to the > prompt.
This is bash's continuation prompt and means that the command being entered is
incomplete. Bash will continue issuing the continuation prompt until the entire
command line is entered.
To change the text color to blue, background color to 90% gray, tooltip text to green and tooltip
background to orange, enter:
sudo u gdm gconftool2 type string set /desktop/gnome/interface/gtk_color_scheme
"fg_color: blue < Press Enter>
> bg_color: grey90 < Press Enter>
> tooltip_fg_color: green < Press Enter>
> tooltip_bg_color: orange" < Press Enter>
Screenshot 22: Changing the color scheme
Cursor Theme
The cursor theme controls the appearance of the cursor (mouse pointer, insertion caret etc.). Cursor
themes are located in separate directories under the /usr/share/icons directory.
To use the DMZBlack cursor theme, enter:
sudo u gdm gconftool2 type string set /desktop/gnome/peripherals/mouse/cursor_theme "DMZ
Black"
To set the size to 48, enter:
sudo u gdm gconftool2 type int set /desktop/gnome/peripherals/mouse/cursor_size 48
To set the cursor's blink rate (value is in ms), enter:
sudo u gdm gconftool2 type int set /desktop/gnome/interface/cursor_blink_time 250
To stop the cursor from blinking, enter:
sudo u gdm gconftool2 type bool set /desktop/gnome/interface/cursor_blink false
Screenshot 23: Changing the cursor theme
Compositing
Compositing is really a hairball topic when it comes to GDM. There are many who believe that it is not
possible. While it may not make much sense to most, this section will show that it is quite possible to
enable compositing at the GDM screen. Either Metacity or Compiz can be used as the compositing
manager. In fact, it is even possible to use the Emerald window manager. While Metacity is by far the
easiest to configure, Compiz offers the most visual effects. This section will concentrate mainly on
Compiz.
Metacity
Verify that the /usr/share/gdm/autostart/LoginWindow/metacity.desktop file exists by entering:
ls l /usr/share/gdm/autostart/LoginWindow | grep metacity*
The command should return something similar to:
rwrr 1 root root 522 20091208 08:28 metacity.desktop
This file should almost certainly exist. If however, for some reason it does not, it is included in the
downloaded tar file. Copy it to the /usr/share/gdm/autostart/LoginWindow/ directory by entering
(/dir/ is the directory where the file was extracted to):
sudo cp /dir/metacity.desktop /usr/share/gdm/autostart/LoginWindow/
Metacity is enabled by default as the compositing manager. It stores its configuration information in
the following sections of the Gconf database:
/apps/metacity/general
/apps/metacity/global_keybindings
/apps/metacity/keybinding_commands
/apps/metacity/window_keybindings
/apps/metacity/workspace_names
At this point, it is up to the reader to configure Metacity accordingly.
Please refer to the /usr/share/gconf/schemas/metacity.schemas file for further information on any key
value pair.
HINT: To display a list of the keyvalue pairs in a section, enter (section_name is any of the above
mentioned sections):
sudo u gdm gconftool2 recursivelist section_name
Compiz
If Compiz is not already installed, do it now. To install it together with it's configuration utility and
some additional packages, enter:
sudo aptget install compiz compizconfigsettingsmanager fusionicon compizconfigbackendgconf
Several things must be done to enable compiz for GDM. First, the compiz.desktop file must be created
in the /usr/share/gdm/autostart/LoginWindow/ directory. Instead of creating this file from scratch,
copy it from the /usr/share/appinstall/desktop/ directory:
sudo cp /usr/share/appinstall/desktop/compiz.desktop /usr/share/gdm/autostart/LoginWindow/
Now open the file for editing:
gksudo gedit /usr/share/gdm/autostart/LoginWindow/compiz.desktop
Add the following line to the file:
AutostartCondition=GNOME /apps/gdm/simplegreeter/wm_use_compiz
Save the file and close gedit.
To enable Compiz, enter:
sudo u gdm gconftool2 type bool set /apps/gdm/simplegreeter/wm_use_compiz true
And to disable Compiz, enter:
sudo u gdm gconftool2 type bool set /apps/gdm/simplegreeter/wm_use_compiz false
Depending on the number of plugins installed there may be as much as 100 schema files that describe
Compiz's configuration. This makes it quite a task to configure it using the gconftool2 tool. Luckily,
there is a much simpler method, enter:
gksudo u gdm dbuslaunch ccsm
This launches the CompizConfig Settings Manager as the gdm user. Compiz may now be configured
just as it would from the user's desktop.
Screenshot 24: Adding a shadow using Compiz
Add a dock
Finally, let's add a dock to GDM. This section will concentrate on adding CairoDock, but the
procedure should also work for most other docks. If CairoDock is not already installed, install it using
the following command:
sudo aptget install cairodock
sudo cp /dir/cairodock.desktop /usr/share/gdm/autostart/LoginWindow/
Open the file for editing:
gksudo gedit /usr/share/gdm/autostart/LoginWindow/cairodock.desktop
Uncomment the appropriate line to use CairoDock with or without OpenGL support.
Save the file and exit gedit.
Finally, create a new keyvalue pair in the gconf database that would allow the dock to be enabled or
disabled easily. To create the new keyvalue pair and set it to show the dock, enter:
sudo u gdm gconftool2 type bool set /desktop/gnome/applications/dock/show_dock true
Logout and if everything went well, the dock should now be shown in GDM. The dock can be
configured from GDM just as it would from the user's desktop.
NOTE: For more information on desktop files have a look at:
http://standards.freedesktop.org/desktopentryspec/latest/index.html
Hint: Now that much of the basics of using the gconftool2 tool for manipulating the keyvalue
pair is known, a much simpler method is to use the gconfeditor application. This is a
simple GUI application for manipulating the keyvalue pairs in the gconf database. To
launch it as the gdm user, enter:
gksudo u gdm dbuslaunch gconfeditor
Hint: And a much simpler method of changing the login screen's gtk+ theme, window border,
mouse theme, fonts etc is:
gksudo u gdm dbuslaunch gnomeappearanceproperties
Screenshot 25: Adding CairoDock
Login Sound
While this is not graphics related, this section just would not be complete without it.
One of the most common problem with the login screen is getting the login sound to work. Hopefully,
the following procedure will solve this very common dilemma.
NOTE: Please ensure that the computer sound system works properly before proceeding. If there
are problems with the sound system, take a look at these threads from the Ubuntu forums
website:
http://ubuntuforums.org/showthread.php?p=4928900&highlight=partition+size
http://ubuntuforums.org/showthread.php?t=205449
If fixing any existing sound problems fixes the login sound, great, continue from the Customizing
Login Sound section below. If the login sound still does not work, try the following fix.
NOTE: Please make sure each step works properly before proceeding to the next.
Install the required packages:
sudo aptget install libcanberra0 libcanberragtkmodule libcanberragtk0 gnomesession
canberra libcanberrapulse
Ensure these packages are installed without any errors. Any errors in the installation would prevent the
login sound from working.
http://www.freedesktop.org/wiki/Specifications/soundthemespec
Check that canberragtkplay works properly. Sound effects must be enabled on the desktop to test the
canberragtkplay function. To enable sound effects on the desktop, click on:
System => Preferences => Sound
Screenshot 26: Sound Preferences
Now enter the following command in the terminal window:
canberragtkplay id="systemready"
This command plays a short drum beat. If the drum beat did not play, recheck all of the above before
continuing.
Verify that the /usr/share/gdm/autostart/LoginWindow/libcanberrareadysound.desktop file exists,
enter:
ls l /usr/share/gdm/autostart/LoginWindow/ | grep lib*
The command should return something similar to:
rwrr 1 root root 399 20100306 23:37 libcanberrareadysound.desktop
If the file does not exist, it must be created. It is included in the downloaded tar file. To copy it to
the /usr/share/gdm/autostart/LoginWindow/ directory, enter (/dir/ is the directory that the file was
extracted to):
sudo cp /dir/libcanberrareadysound.desktop /usr/share/gdm/autostart/LoginWindow/
Test that the file works by opening Nautilus, navigating to the /usr/share/gdm/autostart/LoginWindow/
directory and doubleclicking on the GNOME System Ready Sound file. Again, it should play a short
drum beat.
Finally, enter the following command:
sudo u gdm gconftool2 type bool set /desktop/gnome/sound/event_sounds true
Restart to test that the login sound works.
If not and the computer has multiple soundcards installed, try switching the speakers to another card
and recheck. It should almost certainly work with one of the other soundcard.
Readjust the volume levels in Sound Preferences once the login sound works properly.
Customizing the Login Sound
sudo cp r /usr/share/sounds/ubuntu/ ~/Documents/ubuntu_sound_theme_orig/
And backup the libcanberrareadysound.desktop file by entering:
sudo cp /usr/share/gdm/autostart/LoginWindow/libcanberrareadysound.desktop
~/Documents/libcanberrareadysound.desktop_orig
The simplest method of changing the login sound is to replace the systemready.ogg file with the file
for the new login sound. If the new new login sound is myloginsound.ogg and is stored in the
Documents directory, enter:
cp ~/Documents/myloginsound.ogg /usr/share/sounds/ubuntu/stereo/systemready.ogg
As stated previously, libcanberra relies on the XDG Sound Naming Specification for identifying event
sounds. The id=STRING commandline parameter tells canberragtkplay which event sound to play.
This makes it easy to change the login sound, simply specify the event sound to play using the
id=STRING commandline parameter. For example, to play the desktoplogin sound, enter the
following command in the terminal window:
canberragtkplay id="desktoplogin"
Or, to play the system bell:
canberragtkplay id="bell"
To play a sound file that is not part of the sound theme, use the file=PATH commandline parameter.
To play a file named loginmusic.wav, enter (replace /dir/ with the directory containing the sound file):
canberragtkplay file="/dir/loginmusic.wav"
NOTE: The specified path must be an absolute path. Also, canberragtkplay can only play files in
the ogg, oga and wav format.
To change the volume level of the sound use the volume=STRING commandline parameter. STRING
specifies the volume level as a floating point decibel (db) value. To play the sound at a volume level of
3.0db, enter:
canberragtkplay id="systemready" volume="3.0"
The volume level can also be controlled dynamically by enabling the media keys in GDM. To enable
the media keys, enter:
sudo u gdm gconftool2 type true set /apps/gdm/simplegreeter/settingsmanager
plugins/mediakeys/active true
To make the changes permanent, open the libcanberrareadysound.desktop file for editing. and
change the Exec line. It might look similar to this after editing:
Exec=/usr/bin/canberragtkplay file="/home/user8/Music/beethhoven_8_symphony.wav"
description="GNOME System Ready" volume="0.0"
NOTE: To play the login sound but turn off sound effects on the desktop, use the file=STRING
commandline parameter and mute the Alert Volume in the Sound Preferences dialog.
USPLASH
Usplash or, User Bootsplash Utility is the splash screen that's shown just after the boot option is
selected from the Grub menu. It is by far, the most difficult and time consuming of all the
customizations done so far.
First, install the necessary packages and some optional ones:
sudo aptget install libusplashdev gcc make gimp gbdfed
While not absolutely necessary, a programming background, or at least, the ability to follow a
program's logic flow will help tremendously. A basic understanding of compiling C source code would
be a great asset. The compiler that will be used for compiling the themes is the GNU Compiler
Collection or gcc. For further information on gcc have a look at it's website:
http://gcc.gnu.org/
http://www.gimp.org/tutorials
OK, let's get on with the business at hand.
A basic usplash theme consists only of a background image at one or more resolutions and a theme
definition file. More involved themes may also include a custom progress bar and font.
Unlike Xsplash, Usplash does not store the individually elements as separate files. Instead, the files are
all compiled into a single shared object (.so) file. Once this file is created, it is then specified as the
new Usplash theme using the alternatives system. For more information on the alternatives system
open the Ubuntu Help Center and enter man updatealternatives in the search box.
The procedure for creating a usplash theme is quite simple:
• Create the images
• Create the theme definition file
• Convert the images to usplashreadable C code
• Compile and link the files to create the .so file
While the procedure is quite simple, the actual process of creating the theme can be time consuming.
The process of creating a usplash theme generate a lot of files. It is wise to keep them together in a
single directory. Create a new directory named my_usplash in the Documents directory:
mkdir ~/Documents/my_usplash /
Change the working directory to this newly created directory:
cd ~/Documents/my_usplash
Creating a basic usplash theme
The first usplash theme to be created will be a very basic theme with a resolution of 640x480 pixels.
Launch GIMP and create a 640x480 image, or use the test image included in the downloaded tar file.
If this file is used, copy it to the my_usplash directory. In the terminal window, enter (/dir/ is the
directory where the tar file was extracted to):
cp /dir/usplash_640_480.png ~/Documents/my_usplash/
If an image was created with GIMP it must be saved as an indexed file with a maximum of 256 colors.
To do this, click on:
Image => Mode => Indexed
Copy the theme definition file from the downloaded tar file to the my_usplash directory:
cp /dir/myusplashbasictheme.c ~/Documents/my_usplash/myusplashtheme.c
Convert the image to usplashreadable C code, enter:
pngtousplash usplash_640_480.png > usplash_640_480.c
Compile and link the theme (create the .so file):, enter:
gcc g Wall fPIC c usplash_640_480.c myusplashtheme.c
gcc g Wall fPIC shared usplash_640_480.o myusplashtheme.o o myusplash.so
Now add it to the list of alternatives:
sudo updatealternatives install /usr/lib/usplash/usplashartwork.so usplashartwork.so
~/Documents/my_usplash/myusplash.so 10
And finally, select it:
sudo updatealternatives config usplashartwork.so
Copy the usplashtest.sh file that's included in the downloaded tar file to the my_usplash directory:
sudo cp /dir/usplashtest.sh ~/Documents/my_usplash/
Test the new theme (press Super+F7 to return to the desktop):
sudo ./usplashtest.sh x 640 y 480
or, enter:
sudo usplash c x 640 y 480
Both does the same thing, but the script will come in handy later on.
Using a background image smaller than the screen's dimension
The above theme used a full screen image that had the same dimensions as the theme's resolution, but a
smaller image can also be used. Using the previous image, scale it to 50% with GIMP. To do this,
open the image in GIMP and click on:
Image => Scale Image
In the Scale Image Dialog, set the width to 320 pixels and the height to 240 pixels. Click on Scale and
save the image.
Open the myusplashtheme.c theme definition file for editing, enter:
gedit ~/Documents/my_usplash/myusplashtheme.c
HINT: Turn on line numbering in gedit. Click on:
Edit => Preferences
Select the Display Line Number option under the View tab.
The theme_width and theme_height variables at lines 70 and 71 sets the theme's resolution. A value of
0 tells usplash to use the dimensions of the image as the theme's resolution, but because the image is
now smaller, it must explicitly be set to the theme's resolution. Set the values of these two variables to
640 and 480 respectively:
.theme_width = 640,
.theme_height = 480,
The pixmap_x and pixmap_y variables at lines 74 and 75 tells usplash where to position the image on
the screen. The pixmap_x variable specifies the left position and the pixmap_y variable specifies the
top position. Set these to 160 and 40 respectively:
.pixmap_x = 160,
.pixmap_y = 40,
Save the file and exit gedit.
Convert the scaled image to usplashreadable C code:
pngtousplash usplash_640_480.png > usplash_640_480.c
Compile and link:
gcc g Wall fPIC c usplash_640_480.c myusplashtheme.c
gcc g Wall fPIC shared usplash_640_480.o myusplashtheme.o o myusplash.so
The myusplash.so file is already selected from the list in the alternatives system, so there is no need to
select it again.
Test (press Super+F7 to return to the desktop):
sudo ./usplashtest.sh x 640 y 480
Text Box
The text box is the region of the screen where the boot messages are displayed. The boot message
consist of two parts; the first part is a description of the process being executed, and the second part is
the status which indicates whether the process succeeded or not. If it succeeded OK is displayed, if it
did not succeed FAIL is displayed.
The position and size of the text box is set by the text_x, text_y, text_width and text_height variables at
lines 93 to 96. Set the values of these variables to 160, 300, 320 and 100 respectively:
.text_x = 160,
.text_y = 300,
.text_width = 320,
.text_height = 100,
This places the text box just below image and gives it a width of 320 pixels (the width of the image)
and a height of 100 pixels.
The line_height and line_length variables at lines 99 and 100 sets the height and length of the lines in
the text box. The height is specified in pixels and the length in number of characters. The line length
sets the number of characters used to display the first part of the boot message, ie.: the description of
the process being executed. Set the height to 14 pixels and the length to 32 characters:
.line_height = 14, /* Height of the text line in pixels. */
.line_length = 32, /* Length of the text line in no, of characters. */
The width of the status part is set by the status_width variable at line 101. It is specified in pixels (not
characters) starting from the right side of the text box. Set the width of the status area to 35 pixels:
.status_width = 35, /* Width of the text status area (starting from the right hand side of the
text box) in pixels. */
The text_background, text_foreground, text_success and text_failure variables at lines 81 to 84 sets the
colors used for drawing the text. The following is a description for each of these:
Variable Description
text_background Sets the text box background color
text_foreground Sets the color of the descriptive text
text_success Sets the color of the success text (OK)
text_failure Sets the color of the failure text (FAIL)
The colors specified here are not color names or hexadecimal values as used for grub and xsplash, but
rather the index of the colors in the image's color palette. To see the color palette of the image, open it
in GIMP and click on:
Colors => Map => Rearrange Color Map
The numbers shown below the colors are used to specify the text colors.
Set the foreground, success and failure colors to 121, 100 and 255 respectively:
.text_foreground = 121, /* Palette index to use for the text color. */
.text_success = 100, /* Palette index to use for the text indicating success (OK). */
.text_failure = 255, /* Palette index to use for the text indicating failure (FAILED). */
Save the file and close gedit.
Compile and link:
gcc g Wall fPIC c usplash_640_480.c myusplashtheme.c
gcc g Wall fPIC shared usplash_640_480.o myusplashtheme.o o myusplash.so
Test (this is where the test script comes in handy):
sudo ./usplashtest.sh x 640 y 480
Custom font
Usplash can use a custom font for drawing the text. The font used must be in the BDF format.
For more information on BDF fonts have a look at this webpage:
http://en.wikipedia.org/wiki/BDF_%28Glyph_Bitmap_Distribution_Format%29
Additional BDF fonts are available here:
http://xorg.freedesktop.org/releases/individual/font/
Use the gbdfed application installed earlier to view the downloaded fonts. To launch it, enter:
gbdfed
NOTE: While monospaced (fixedwidth) fonts can be used, Usplash recommends the use of
proportional fonts.
A custom font is included in the downloaded tar file. Copy it to the my_usplash directory by entering:
cp /dir/term14.bdf ~/Documents/my_usplash/
The data structure for the font must be declared and a pointer to it added in the theme definition. Open
the myusplashtheme.c file with gedit:
gedit ~/Documents/my_usplash/myusplashtheme.c
Declare the font's data structure by adding the following lines (the numbers at the beginning of each
line are the line numbers shown in gedit):
38
39 /* Declaration for our custom font's data structure. */
40 extern struct usplash_font font_term14;
41
Add the pointer in the theme definition by adding the following lines:
67 .font = &font_term14,
68
The beginning of the file should look like this (the newly edited lines are shown in bold):
/* 640x480 */
extern struct usplash_pixmap pixmap_usplash_640_480;
/* We can add data structures for other image resolutions if we want,
* but for the purposes of this tutorial we'll keep it simple
* and stick to the above four.
*/
/* Declaration for our custom font's data structure. */
extern struct usplash_font font_term14;
void t_init(struct usplash_theme* theme);
/* Declarations for our theme definitions. */
struct usplash_theme usplash_theme;
/* We will now define the data structures for the theme definitions */
/* Data structure definition for the 640x480 theme. */
struct usplash_theme usplash_theme = {
/* ALWAYS set this to THEME_VERSION, it's a compatibility check */
.version = THEME_VERSION,
/* A pointer to our next theme resolution.
* If this is our last theme definition we must specify NULL.
*/
.next = NULL,
/* The aspect ratio to use for this resolution.
* This must be either USPLASH_4_3 for a 4:3 aspect ratio or,
* USPLASH_16_9 for a 16:9 aspect ratio.
*/
.ratio = USPLASH_4_3,
/* Background and font data structure pointers.*/
.pixmap = &pixmap_usplash_640_480,
.font = &font_term14,
Save the file and close gedit.
Before compiling, the font must be converted to usplashreadable C code. Enter:
bdftousplash term14.bdf > term14.c
Compile and link (note the newly created font file is now included in the commands):
gcc g Wall fPIC c usplash_640_480.c term14.c myusplashtheme.c
gcc g Wall fPIC shared usplash_640_480.o term14.o myusplashtheme.o o myusplash.so
Finally, test:
sudo ./usplashtest.sh x 640 y 480
Progress Bar
Usplash has a very basic builtin progress bar. The position and size of the progressbar are set by the
progressbar_x, progressbar_y, progressbar_width and progressbar_height variables at lines 91 to 94.
Set the values of these to 0, 472, 640 and 8 respectively:
.progressbar_x = 0,
.progressbar_y = 472,
.progressbar_width = 640,
.progressbar_height = 8,
This places the progressbar at the bottom of the screen with a height of 8 pixels and makes it as wide
as the theme's width.
The progressbar's background and foreground colors are set by the progressbar_background and
progressbar_foreground variables at lines 83 and 84 respectively. Set the background color to color
index 255 and the foreground to color index 10:
.progressbar_background = 255, /* Palette index to use for the progressbar background color. */
.progressbar_foreground = 10, /* Palette index to use for the progressbar foreground color. */
Compile and link:
gcc g Wall fPIC c usplash_640_480.c term14.c myusplashtheme.c
gcc g Wall fPIC shared usplash_640_480.o term14.o myusplashtheme.o o myusplash.so
And test:
sudo ./usplashtest.sh x 640 y 480
Well, this just couldn't be helped. A Full Screen Progress Bar!!!
.progressbar_x = 0,
.progressbar_y = 0,
.progressbar_width = 640,
.progressbar_height = 480,
Compile, link and test !!!
Custom Progress Bar
That was usplash builtin progress bar. Luckily, usplash allows for the creation of custom progress bars.
Three images must be created; the familiar background image, the progress bar background image and
the progress bar foreground image. So why not use the previous background image? Simply because
the color palette will now be different. Remember, all of the images must have the same color palette.
One method of doing this is to create one large image containing the abovementioned images. Then,
convert this large image to indexed mode and cut each individual image and save them separately.
cp /dir/usplash.xcf ~/Documents/my_usplash/
This is one method of creating the abovementioned three images all with the same color palette using
GIMP:
1. Open the usplash.xcf image file in GIMP. The image consists of six layers with each image
on a different layer. This makes editing easier later on. There is the now familiar background
image, the progress bar background image is the shaded gray bar, the progress bar foreground
image is the shaded blue bar, the red box is the color for the FAILURE text, the green box is the
color for the SUCCESS text and the blue box is the color for the text foreground.
2. Flatten the image. Click on Image => Flatten Image. This creates an image with one layer.
3. Set the color palette to 256 colors. Click on Image => Mode => Indexed. Select Generate
Optimum Palette and set maximum number of colors to 256. Click on Convert.
4. Create the background image. Using the Rectangle Select Tool, select the background image
starting at 0,0 with a size of 320x240. Click on Image => Crop to Selection. Save as
usplash_640_480.png.
5. Create the progress bar background image. Click on Edit => Undo Crop Image. Using the
Rectangle Select Tool, select the progress bar background image starting at 0,300 with a size of
640x10. Click Image => Crop to Selection. Save as throbber_back_640_480.png.
6. Create the progress bar foreground image. Click on Edit => Undo Crop Image. Using the
Rectangle Select Tool, select the progress bar foreground image starting at 0,320 with a size of
640x10. Click on Image => Crop To Selection. Save as throbber_fore_640_480.png.
7. Close GIMP.
cp /dir/myusplashthemecustomprogressbar.c ~/Documents/my_usplash/myusplashtheme.c
There are several major changes to the theme definition file. Lines 40 and 43 declares the data structure
for the progress bar foreground and background images respectively. Three new functions have also
been added that draws the custom progress bar. These new functions are:
• t_clear_progressbar_640_480. This function clears the progress bar.
• t_draw_progressbar_640_480. This function draws the progress bar.
• t_animate_step_640_480. This function animates the progress bar or pulsates it (pingpong in
xsplash terms).
Convert the new images to usplashreadable C code:
pngtousplash usplash_640_480.png > usplash_640_480.c
pngtousplash throbber_back_640_480.png > throbber_back_640_480.c
pngtousplash throbber_fore_640_480.png > throbber_fore_640_480.c
Compile and link (note the new image files are now included in the commands). Each command is
entered on one line:
gcc g Wall fPIC c usplash_640_480.c throbber_back_640_480.c
throbber_fore_640_480.c term14.c myusplashtheme.c
gcc g Wall fPIC shared usplash_640_480.o throbber_back_640_480.o
throbber_fore_640_480.o term14.o myusplashtheme.o o myusplash.so
And test:
sudo ./usplashtest.sh x 640 y 480
Adding Other Resolutions
The theme created so far has only one resolution defined in the theme definition file. A well designed
theme should cater for every conceivable resolution or, for the very least, the most common ones. The
procedure for adding additional theme resolutions to the theme definition file will be outlined in this
section.
A theme definition file containing four theme resolutions is included in the downloaded tar file. Copy
it to the my_usplash directory and open it with gedit:
cp /dir/myusplashtheme4.c ~/Documents/my_usplash/myusplashtheme.c
gedit ~/Documents/my_usplash/myusplashtheme.c
The theme definition file has theme definitions and custom draw functions for the following four
resolutions:
• 640x480
• 800x600
• 1024x768
• 1280x1024
A theme definition must be created for each additional resolution. The themes are linked by the next
variable which must point to another theme in the theme definition file and, set to NULL in the last
theme. The first theme definition must always be named usplash_theme. This should be the lowest
resolution theme with a 4:3 ratio. Usplash will use this theme if no usable theme is found for the
specified resolution. This is referred to by Usplash as the fallback theme.
Looking at the new theme definition file, the theme definitions for the above resolutions are named:
• for the 640x480 resolution (the fallback theme):
usplash_theme
• for the other resolutions:
usplash_theme_xres_yres (xres=horizontal resolution, yres=vertical resolution)
The new theme definition file also includes custom draw functions for the progress bar for each
resolution. These functions are named:
• t_clear_progressbar_xres_yres
• t_draw_progressbar_xres_yres
• t_animate_step_xres_yres
where xres and yres are the horizontal and vertical resolutions respectively.
The data structures for the different images are declared at the beginning of the file. The names of the
image files use the following format:
• for the background image:
usplash_xres_yres
• for the progress bar foreground image:
throbber_fore_xres_yres
• for the progress bar background image:
throbber_back_xres_yres
where xres and yres are the horizontal and vertical resolutions respectively.
NOTE: An image may be used in one or more theme definitions. For example, the
usplash_640_480 background image may be used for both the 640x480 and the 800x600
resolutions.
A test image named usplash4.xcf is included in the downloaded tar file. Use it to create the different
images for the new theme definition file. Name the image files as mentioned above.
The theme is created using the following set of commands:
Convert images to usplashreadable C code:
pngtousplash usplash_640_480.png > usplash_640_480.c
pngtousplash usplash_800_600.png > usplash_800_600.c
pngtousplash usplash_1024_768.png > usplash_1024_768.c
pngtousplash usplash_1280_1024.png > usplash_1280_1024.c
pngtousplash throbber_fore_640_480.png > throbber_fore_640_480.c
pngtousplash throbber_fore_800_600.png > throbber_fore_800_600.c
pngtousplash throbber_fore_1024_768.png > throbber_fore_1024_768.c
pngtousplash throbber_fore_1280_1024.png > throbber_fore_1280_1024.c
pngtousplash throbber_back_640_480.png > throbber_back_640_480.c
pngtousplash throbber_back_800_600.png > throbber_back_800_600.c
pngtousplash throbber_back_1024_768.png > throbber_back_1024_768.c
pngtousplash throbber_back_1280_1024.png > throbber_back_1280_1024.c
bdftousplash term14.bdf > term14.c
Compile:
gcc g Wall fPIC c usplash_640_480.c usplash_800_600.c usplash_1024_768.c
usplash_1280_1024.c throbber_fore_640_480.c throbber_fore_800_600.c
throbber_fore_1024_768.c throbber_fore_1280_1024.c throbber_back_640_480.c
throbber_back_1024_768.c throbber_back_1280_1024.c term14.c myusplashtheme.c
And link:
gcc g Wall fPIC shared usplash_640_480.o usplash_800_600.o usplash_1024_768.o
usplash_1280_1024.o throbber_fore_640_480.o throbber_fore_800_600.o
throbber_fore_1024_768.o throbber_fore_1280_1024.o throbber_back_640_480.o
throbber_back_1024_768.o throbber_back_1280_1024.o term14.c myusplashtheme.o
o myusplash.so
That's a lot of typing, making it prone to errors. There is a simpler way though, use a makefile.
Using a makefile
http://en.wikipedia.org/wiki/Make_%28software%29
http://www.gnu.org/software/make/
http://www.gnu.org/software/make/manual/make.html
A makefile is included in the downloaded tar file. Copy it to the my_usplash directory:
cp /dir/Makefile ~/Documents/my_usplash/
To create the above theme, enter:
make
This executes all of the above commands.
To test the new theme, enter:
sudo ./usplashtest.sh x xres y yres
where xres and yres are the horizontal and vertical resolutions respectively.
Finalizing it all
Usplash stores it's themes in the /usr/lib/usplash/ directory. Copy the new theme there:
sudo cp ~/Documents/my_usplash/myusplash.so /usr/lib/usplash/
Or, if the makefile was used, enter:
sudo make install
Add it to the list of alternatives:
sudo updatealternatives install /usr/lib/usplash/usplashartwork.so usplashartwork.so
/usr/lib/usplash/myusplash.so 10
Select it:
sudo updatealternatives config usplashartwork.so
Remove the old myusplash.so file from the list of alternatives:
sudo updatealternatives remove usplashartwork.so ~/Documents/my_usplash/myusplash.so
It's a good idea to remove all unnecessary files from the my_usplash directory:
rm f usplash*.c throbber*.c term14.c *.o *.so
Or, if the makefile was used:
make clean
During testing, the resolution was specified from the command line. During bootup however, usplash
uses the resolution specified in the /etc/usplash.conf file. Open the file for editing:
gksudo gedit /etc/usplash.conf
Tell usplash the resolution to use by changing the xres and yres values.
If the computer is restarted now, the new theme will be shown at shutdown and not at startup. For the
theme to be shown at startup, it must be added to the initial RAM filesystem (initramfs). For more
information on initramfs, look at the following online resources:
http://en.wikipedia.org/wiki/Initrd
http://www.linuxfordevices.com . . . initialRAMdisks/
https://wiki.ubuntu.com/Initramfs
To update the initramfs, enter:
sudo updateinitramfs u
Reboot.
Two Usplash themes
Different themes can be used for startup and shutdown. To set the startup theme, select it from the
alternatives system and update the initramfs and now set the shutdown theme by selecting it from the
alternatives system.
NOTE: Anytime the initramfs is updated, the startup theme will be set to the last theme selected.