Monday, 10 October 2005

3dDesktop - The Desktop switcher on steroids

I am amazed when people pass comments like - Linux is drab, graphic applications in Linux are primitive and so on. These comments may have had some validity a few years back; But not any longer. For one, OpenGL which is a well developed graphics engine has strong support on the Linux platform. One just have to look at any application which uses OpenGL libraries to understand the true power behind this graphics engine. I tell each and everyone even remotely interested in computers that Linux has come of age and it is definitely going to be a real threat to its commercial counterparts.
Here I will describe a nifty utility which can be used to switch your desktop - that is right, Linux has multiple desktops (4 by default). This utility is called 3dDesktop. 3D-Desktop is a program for switching virtual desktops in a seamless 3-dimensional manner on Linux. The current desktop is mapped into a fullscreen 3D environment where you may choose other screens.It uses OpenGL for rendering the special effects. If you are running 3dDesktop, you can have quite a number of special effects in the same leagues as those in Mac OSX.

But first the prerequisites:

For successfully running any application using OpenGL, you need a good graphics card having atleast 64 MB memory. If your PC does not have a graphics card, your experience of running 3dDesktop will be atmost crappy. For example, I have a NVIDIA Graphics card installed in my machine.

3dDesktop is usually shipped with all major Linux distributions. But if it is not installed on your machine, you can download it from its website and install it.
The 3dDesktop package installs amoung others, three important files. They are :
  1. 3ddeskd - Which is the server (daemon) which should work in the background
  2. 3ddesk - The client which is used to show the special effects to the user. And
  3. 3ddesktop.conf - which is the system wide configuration file which contains details like what kind of special effects need to be shown and so on. The contents of this file could be overridden.
How to make it work
First fire up xterm and start the 3ddesktop server (3ddeskd).
$ 3ddeskd --wm=fluxbox --acquire --texturesize=1024 &
In the above command, I have passed the type of window manager I am using with the --wm option, acquire screenshots of all my desktops with the --acquire option and used a texture size of 1024 (must be multiples of 2 with a minimum value of 128) with the --texturesize option. I have used Fluxbox as my window manager. But you can pass the name of the window manager in which you are working, in the --wm option.

From now on, when ever you want to switch the desktop, you run the client part of the package which is 3ddesk. It can be passed a few options; the important ones being :
--view - This option decides the kind of graphics effects to show. The different values being goright, goleft, slide, zoom, nozoom, linear, linearzip and bigmoney.
--mode - This option sets the arrangement of the special effects. The effects being carousel (which is the default), cylinder, linear, viewmaster, priceisright, flip or random.

Of course, you can also run 3ddesk without passing any options in which case, it reads the default options from the /etc/3ddesktop.conf configuration file.

Here are a few examples of how to start the show.
$ 3ddesk
... accepts the default options.
$ 3ddesk --mode=cylinder --view=zoom
... the desktop takes the shape of a cube.
$ 3ddesk --view=bigmoney
... Vertical rotation

Once you execute any of the above commands, try switching the desktop by rotating the mouse wheel or clicking the left or right mouse buttons. And select the desktop by clicking the middle button (wheel).You can also rotate the desktop by using the arrow keys on your keyboard and then select your desktop by pressing enter.

Mapping a Key Sequence to start 3ddesk
This utility becomes really useful when you map a key sequence to execute the 3ddesk (client) program in your window manager. In KDE and GNOME, it is a snap. Here I will explain how to map a key sequence in Fluxbox (my window manager of choice) to start 3ddesk.

If you are running fluxbox as your window manager, you will have a hidden directory by name .fluxbox in your home directory.
$ ls -al | grep fluxbox
This hidden directory contains the configuration files for this window manager. Now open the file ~/.fluxbox/keys in your favorite editor and insert the following lines.
#FILE: ~ravi/.fluxbox/keys
# Use 3ddesk to change desktop
Mod4 KP_6 :ExecCommand 3ddesk --gotoright
Mod4 Right :ExecCommand 3ddesk --gotoright --nozoom
Mod4 KP_4 :ExecCommand 3ddesk --gotoleft
Mod4 Left :ExecCommand 3ddesk --gotoleft --nozoom
Mod4 Down :ExecCommand 3ddesk --mode=viewmaster
The above lines map a key sequence to execute 3ddesk program. For example, if I press the [Windows key] and the 6 in the keypad simultaneously, it will automatically execute the 3ddesk command on the first line in the above listing. Here,
Mod4 - Window Key on your keyboard
KP_6 - The 6 on your number pad.
Mod1 - Alt key

Now you reload the configuration file in fluxbox. That is it. Now to switch your desktop, you just have to press [WindowKey + left arrow]. Or try [Win Key + Down arrow].


Figure 1 : Vertical Flip

Figure 2 : Vertical flip continued

Figure 3: Viewmaster mode

Figure 4: Bigmoney mode


Figure 5: Cylindrical mode

Note: For the 3ddeskd daemon to start each time you boot into Linux, you have to set it up in the configuration file. I have inserted the following line in the ~ravi/.fluxbox/startup file.

# FILE: /home/ravi/.fluxbox/startup
if [ -x /usr/bin/3ddeskd ]; then
3ddeskd
fi
All code in the file /home/ravi/.fluxbox/startup will be executed when you log into fluxbox. So that does the trick of starting the 3ddeskd daemon automatically.

Next time if anybody starts giving you a sermon about the beauty of Mac OSX, direct them to this article. :)

No comments:

Post a Comment