Steady as a rock

…or so they say

 

More fun with usplash

Usplash themes are nothing more than png images, translated to C code and a few functions for drawing progress bars, animation etc. The actual drawing primitives are defined in the usplash binary (well, actually in libusplash). So in theory one could use these themes from other applications as well, as long as the required drawing primitives are available.

One of the annoying things of usplash themes is that it’s non-intuitive how you should switch between them, it needs both update-alternatives and update-initramfs. “Magic un-userfriendly incantations” some would say, and I agree.
Combine those two things and add a night of GTK hacking. Never having programmed with GTK in C before, I needed the manual quite often (the manual is great!). But the PyGTK experience helped Smile

Main window: Overview of all installed themes:

screenshot-usplash-switcher-main.png

Preview window: slightly larger image and show which resolutions are supported:
screenshot-preview-of-usplash-theme-edubuntuso.png
Click on the switch button and it will perform the magic incantations for you

screenshot-usplash-switcher-switching.png

And a minute later, you have switched!

screenshot-usplash-switcher-1.png

Too bad it’s already past Feature Freeze for Ubuntu Edgy, but I hope to get this included for Edgy +1 (Will it be Fuzzy Ferret, Frisky Firefly or Foxy Fish?)

Update: Here’s the source

Filed under : Ubuntu
By Dennis Kaarsemaker
On September 13, 2006
At 17:42
Comments :
 

29 Comments for this post

 
folken Says:

Great stuff. Why to wait for Edgy+1, public source code today :) Those, who want to use it, would compile it and use for own risk.

 
 
dré Says:

Flying Frog!

 
 
Daniel Says:

Looks great, unfortunate about the timing, is there still a chance you could get it into the universe repositories for edgy? Would be great to have access to such a tool.

 
 
Christian Says:

Yes, i agree with this guys its look very usefull

 
 
nonnano Says:

Can’t you still get this to universe or multiverse despite of the freeze, somehow? This is awesome stuff and should be installed by default.

 
 
Dennis Kaarsemaker Says:

nonnano: Universe stuff isn’t installed by default.

 
 
Azrael Nightwalker Says:

But it can be installed at will.

Will it be backported to Dapper?

 
 
Dennis Kaarsemaker Says:

No, it needs gtk 2.10 — which is not available in dapper.

 
 
|FoLKeN|@weblog » Yeah Says:

[…] Denis Kaarsemaker na swoim blogu opublikował screeny ze stworzonej przez siebie aplikacji do zmiany tematów Usplasha! Aplikacja nie wejdzie już raczej do Edgy’ego, ale wciąż mam nadzieję, że opublikuje chociaż źródła. Więcej informacji na http://blogs.ubuntu-nl.org/dennis/2006/09/13/more-fun-with-usplash/. […]

 
 
Matt Philmon Says:

What packages are needed to build it successfully on Edgy? Any attempts at creating a deb? I’d love to try it out but am running into some build problems

 
 
Corey Says:

Not terribly important. But it is this kind of extra spit and polish that makes ubuntu a cut above the rest. Shame about not making edgy but thats the way it goes. Releases gotta cut off sometime. It does seem, though, like I’m always waiting for Ubuntu n+2 where n is the ubuntu release I currently have installed.

 
 
Dennis Kaarsemaker Says:

Matt: look at the comments at the top of the source file
Corey: It’s good to have something to look forward to ;)

 
 
linuxtoy.org Says:

Usplash switcher…

这个 Dennis Kaarsemaker 写了个名叫 Usplash switcher 的工具,使用该工具不仅可以对系统中已安装的 Usplash 主题进行有效管理,而且可以在各个主题间轻松切换。伴随着每天都有一个新的引导屏幕,….

 
 
Matt Philmon Says:

AHHH: RTFM!

:) Sorry about that.

 
 
meneame.net Says:

Cambiar de tema con usplash…

USplash es una aplicación que usa el _framebuffer_ en Linux para monstrar una imagen en el arranque del sistema, mostrando la información típica de ese proceso de una forma más atractiva. Dennis Kaarsemaker ha programado para Ubuntu una pequeña he…

 
 
JustAnotherUselessPage » usplash-switcher Says:

[…] Usplash-switcher is an easy way to choose which of the installed usplashes is active. […]

 
 
zenrox Says:

works great
looks like it dont find all .so files in the /usr/lib/usplash dir
i suspect blow line 90 is the issue

 
 
ZarK Says:

This is superb! I can’t get the problem to detect any other themes though… where am I supposed to put my .so files so the program will read them?

 
 
Dennis Kaarsemaker Says:

You’re supposed to install them properly, including adding them to the usplash-artwork.so alternative.

 
 
Chiller Says:

Hi, I’m a complete noob in ubuntu. How do we use this source? I tried “chmod 755 usplash.sh” (because I saved it as usplash.sh.
Could someone help me with this?

 
 
Petar Says:

@Chiller

This a C source file, you have to compile it by issuing a command in terminal
gcc usplash-source.c
and copying resulting binary in e.g. /usr/bin.

 
 
Tiede Says:

Do we need to install additional libraries in spite of the default ones?
I tried compiling it (both via terminal and via CodeBlocks ) and I get an error.
It says that it cannot find the appropriate headers.
Exact message is: error: gtk/gtk.h: No such file or directory.
Am I missing something? Shouldn’t I ALREADY have those libraries installed on Ubuntu Edgy?
P.S:I am compiling from the desktop. But if I remember well from my introductory programming class (’twas just a month ago :D ) it should not matter…

 
 
Tiede Says:

PPS: I already have libgtk2.0-dev installed

 
 
Chiller Says:

Thanks a lot for the gcc hint, but I also have the error message plus a whole bunch of other ones:
hangeusplash.c:37:21: error: gtk/gtk.h: No such file or directory
changeusplash.c:47: error: expected specifier-qualifier-list before ‘GtkWidget’
changeusplash.c:53: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ befo
re ‘*’ token
changeusplash.c:54: error: expected ‘)’ before ‘*’ token
changeusplash.c:55: error: expected ‘)’ before ‘*’ token
changeusplash.c:56: error: expected ‘)’ before ‘*’ token
changeusplash.c:57: error: expected ‘)’ before ‘*’ token
changeusplash.c:58: error: expected ‘)’ before ‘*’ token
changeusplash.c:60: error: expected ‘)’ before ‘p’
changeusplash.c:67: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ befo
re ‘*’ token
changeusplash.c: In function ‘main’:
changeusplash.c:71: error: ‘GtkWidget’ undeclared (first use in this function)
changeusplash.c:71: error: (Each undeclared identifier is reported only once
changeusplash.c:71: error: for each function it appears in.)
changeusplash.c:71: error: ‘vb’ undeclared (first use in this function)
changeusplash.c:71: error: ‘hb’ undeclared (first use in this function)
changeusplash.c:71: error: ‘l’ undeclared (first use in this function)
changeusplash.c:71: error: ‘b’ undeclared (first use in this function)
changeusplash.c:71: error: ‘img’ undeclared (first use in this function)
changeusplash.c:79: error: ‘GError’ undeclared (first use in this function)
changeusplash.c:79: error: ‘err’ undeclared (first use in this function)
changeusplash.c:92: warning: assignment makes pointer from integer without a cas
t
changeusplash.c:106: error: ‘struct theme_data’ has no member named ‘name’
changeusplash.c:107: error: ‘struct theme_data’ has no member named ‘name’
changeusplash.c:108: error: ‘struct theme_data’ has no member named ‘name’
changeusplash.c:116: error: ‘MainWindow’ undeclared (first use in this function)
changeusplash.c:116: error: ‘GTK_WINDOW_TOPLEVEL’ undeclared (first use in this
function)
changeusplash.c:118: error: ‘FALSE’ undeclared (first use in this function)
changeusplash.c:119: error: ‘destroy’ undeclared (first use in this function)
changeusplash.c:125: error: ‘TRUE’ undeclared (first use in this function)
changeusplash.c:134: error: ‘struct theme_data’ has no member named ‘button’
changeusplash.c:138: error: ‘GTK_STOCK_MISSING_IMAGE’ undeclared (first use in t
his function)
changeusplash.c:138: error: ‘GTK_ICON_SIZE_DIALOG’ undeclared (first use in this
function)
changeusplash.c:140: error: ‘GTK_POS_TOP’ undeclared (first use in this function
)
changeusplash.c:141: error: ‘struct theme_data’ has no member named ‘name’
changeusplash.c:143: error: ‘switch_theme’ undeclared (first use in this functio
n)
changeusplash.c:150: error: ‘struct theme_data’ has no member named ‘button’
changeusplash.c:156: error: ‘GTK_STOCK_CLOSE’ undeclared (first use in this func
tion)
changeusplash.c:162: error: ‘GTK_STOCK_OK’ undeclared (first use in this functio
n)
changeusplash.c:162: error: ‘GTK_ICON_SIZE_BUTTON’ undeclared (first use in this
function)
changeusplash.c:163: error: ‘GTK_POS_LEFT’ undeclared (first use in this functio
n)
changeusplash.c:165: error: ‘save_theme’ undeclared (first use in this function)
changeusplash.c:168: error: ‘GTK_STOCK_MEDIA_PLAY’ undeclared (first use in this
function)
changeusplash.c:171: error: ‘preview’ undeclared (first use in this function)
changeusplash.c: At top level:
changeusplash.c:181: error: expected ‘)’ before ‘*’ token
changeusplash.c:186: error: expected ‘)’ before ‘*’ token
changeusplash.c:208: error: expected ‘)’ before ‘*’ token
changeusplash.c:255: error: expected ‘)’ before ‘*’ token
changeusplash.c:307: error: expected ‘)’ before ‘p’
changeusplash.c: In function ‘get_alternatives’:
changeusplash.c:322: error: ‘gchar’ undeclared (first use in this function)
changeusplash.c:322: error: ‘out’ undeclared (first use in this function)
changeusplash.c:323: error: ‘GError’ undeclared (first use in this function)
changeusplash.c:323: error: ‘error’ undeclared (first use in this function)
changeusplash.c:324: error: ‘command’ undeclared (first use in this function)
changeusplash.c:330: warning: incompatible implicit declaration of built-in func
tion ‘fprintf’
changeusplash.c:330: error: ‘stderr’ undeclared (first use in this function)
changeusplash.c: In function ‘load_theme’:
changeusplash.c:346: warning: incompatible implicit declaration of built-in func tion ‘fprintf’
changeusplash.c:346: error: ‘stderr’ undeclared (first use in this function)
changeusplash.c:352: warning: incompatible implicit declaration of built-in func tion ‘fprintf’
changeusplash.c:356: warning: incompatible implicit declaration of built-in func tion ‘fprintf’
changeusplash.c: At top level:
changeusplash.c:363: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ bef ore ‘*’ token
changeusplash.c: In function ‘display_error’:
changeusplash.c:392: error: ‘GtkWidget’ undeclared (first use in this function)
changeusplash.c:392: error: ‘dialog’ undeclared (first use in this function)
changeusplash.c:393: error: ‘MainWindow’ undeclared (first use in this function)
changeusplash.c:394: error: ‘GTK_DIALOG_MODAL’ undeclared (first use in this fun ction)
changeusplash.c:394: error: ‘GTK_DIALOG_DESTROY_WITH_PARENT’ undeclared (first u se in this function)
changeusplash.c:395: error: ‘GTK_MESSAGE_ERROR’ undeclared (first use in this fu nction)
changeusplash.c:396: error: ‘GTK_BUTTONS_CLOSE’ undeclared (first use in this fu nction)

 
 
partymola Says:

Follow these steps:

# Install development files for usplash
sudo apt-get install usplash-dev

# Compile usplash-switcher
gcc -o usplash-switcher usplash-switcher.c `pkg-config –libs –cflags gtk+-2.0` -lusplash

# Run usplash-switcher as root
sudo ./usplash-switcher

Enjoy it :)

 
 
partymola Says:

There is a problem with this blog… it substitutes two consecutive dashes with a long dash… so it messes up the compiling line.

Correct line is:
gcc -o usplash-switcher usplash-switcher.c `pkg-config -(removethis)-libs -(removethis)-cflags gtk+-2.0` -lusplash

Don’t forget to remove the “(removethis)” parts… lol

 
 
Peter B. Says:

Aha! Thankyou, partymola. I was just trying ‘gcc usplash-switcher.c’, which wasn’t working.

Now it’s working - but for some reason, some of the images display a bit odd. Oh well, I guess that’s more a problem with usplash-dev that usplash-switcher.

I’m working on a Ruby version of it, simply because I can :)

 
 
lotacus Says:

I’ve compiled it and ran it. Now when the program pops up, it fails to display the themes already installed through synaptic. IE: xubuntu, ubuntu etc.. However, it seems that included in your program is an edubuntu theme which it previews.

When I use the program to set the theme and manually preview using the command sudo usplash -c my screen turns off with hv over frequency.

 
 
systemize Says:

Link to the source is dead, could someone share it or reupload it?

 

Leave a Reply