个人工具

UbuntuHelp:AdeskletsHowto

来自Ubuntu中文

跳转至: 导航, 搜索


Adesklets is a program which allows small monitors and utilities to be placed on the desktop. You may also want to check out Karamba, SuperKaramba, Gkrellm and GDesklets. Whilst these other tools are extremely simple to set up, adesklets takes a bit more configuration, hence the creation of this page.

Introduction

The desktop can be a very boring place, especially since Ubuntu likes to use few icons. Even by adding icons, many common tasks such as reading news, checking for new emails and monitoring the system's resources take a few clicks and key presses, the programs can take a while to start, etc. Desklets attempt to solve these problems by placing graphical mini-applications (commonly called "applets") onto the desktop, and these desklets can constantly give information from news feeds, system monitors, email accounts and more, and since they are constantly on (yet relatively unobtrusive) it is much quicker to access this information. Adesklets takes the approach of providing a few pieces of information to it's desklets (like which X session is being used, what the root window [backdrop] is, etc.) then allowing each desklet to do what it wants.

Set Up

Adesklets

Adesklets itself is easy to install. It is in the Universe repository, so all you need to do is install the adesklets package.

The Desklets Themselves

Getting Them

Since adesklets seperates itself from the desklets themselves, you will need to find some desklets which you like. There is a collection of desklets here. After getting a desklet you should move it to a location where you would like it to live permanently (at least until you uninstall adesklets), then extract it by right clicking on the archive and choosing Extract Here.

Setting Them Up

Desklets initially need to be run manually. Since they are usually python scripts (usually ending in ".py") they can be run from a terminal in the extracted directory with "python filename.py" (where filename.py is the desklet script, usually named similar to the archive). There are two ways of running each desklet, either in "test" mode or "registering" it, you will be asked which action you want to perform when you run the desklet (press the corresponding key, then Enter). To begin with you should run the desklet in test mode, so you can see what it is like and whether you would want to have it on your desktop. To kill a desklet in test mode press ctrl-C (this is the standard way of killing programs being run in a terminal) The desklets are controlled with text files, usually called config.txt, which you can open with any text editor (don't open it if the desklet is running, since your changes may be overwritten). Since every desklet is different it would be impossible to explain how to configure them all, but the text files are usually straightforward. For example, here is a configuration file I use for the "modubar" desklet, which is similar to MacOSX's dock (the thing across the bottom of the screen with the icons in it), but without the extensive comments at the top. The layout is the same as the original and you can see how easy it is to tweak the settings (this desklet looks for icons in a folder called "icons" inside it's directory, and this is where I stored my icon images):

id0 = {'bar_background_1': '202020',
 'bar_background_2': None,
 'bar_foreground': '000000',
 'bar_gradient_angle': 0,
 'bar_height': 48,
 'bar_opacity_1': 100,
 'bar_opacity_2': None,
 'caption_above': True,
 'caption_color': 'FFFFFF',
 'caption_delay': 0.10000000000000001,
 'caption_fade_in': True,
 'caption_fade_in_duration': 0.29999999999999999,
 'caption_fade_in_steps': 10,
 'caption_font': 'Vera',
 'caption_size': 20,
 'click_effect': 'tint(alpha=75,red=75,green=75,blue=125);',
 'click_effect_duration': 0.10000000000000001,
 'icon_max_height': 148,
 'icon_max_width': 148,
 'icon_maximize_threshold': 1.0,
 'icon_min_height': 96,
 'icon_min_width': 96,
 'icon_spacing': 5,
 'icons': [('terminal.png',
            'Terminal', 'gnome-terminal --working-directory /home/chris'),
           ('home.png', 'Files', 'nautilus /home/chris/Files'),
           ('evolution.png', 'EMail', 'evolution --component=mail'),
           ('amarok.png', 'Amarok', 'amarok'),
           ('listen.png', 'Listen', 'listen'),
           ('xmms.png', 'XMMS', 'xmms'),
           ('gimp.png', 'The GIMP', 'gimp'),
           ('inkscape.png', 'Inkscape', 'inkscape'),
           ('moho.png', 'Moho', 'moho'),
           ('abiword.png', 'Abiword', 'abiword'),
           ('sancho.png', 'Sancho', 'sancho'),
           ('gtk-gnutella.png', 'Gnutella', 'gtk-gnutella')],
 'mod_background_1': 'AAAAAA',
 'mod_background_2': None,
 'mod_clock_font': 'Vera',
 'mod_clock_size': 16,
 'mod_font_color': '000000',
 'mod_font_opacity': 'FF',
 'mod_foreground_1': '000000',
 'mod_foreground_2': None,
 'mod_gradient_angle': 0,
 'mod_opacity_1': 100,
 'mod_opacity_2': None,
 'module_height': 32,
 'modules': [('clock', 1)],
 'modules_on': False}

After changing the configuration you can restart the desklet in test mode to try it out. If there is no config.txt or similar file (if there is a README then check in there for what the configuration file is called) then try running the desklet in test mode then killing it (ctrl-C) to see if the file has been created.

Registering Them

When you are happy with a desklet running in test mode you can tell adesklets to run it for you by registering it. This is usually done by running the desklet script, but instead of choosing test you should choose register. Once the desklet has been registered it will be started when you run the adesklets command. You can register many desklets which will all be run when you run adesklets, and it is a good idea to put that command in the session startup (in GNOME this is System->Preferences->Sessions and go on the Startup Programs tab and add it).

Some Final Notes

To kill running desklets (which are registered) you can use:

adesklets -k

To remove desklets which you have registered, but which have been deleted, you can "clean up" the configuration file with:

adesklets -c

Desklets will usually appear in the top left corner of the screen. You can move them by right clicking on them and selecting Move, then left clicking when you are happy with the placement. Adesklets will remember the position of the desklet, so it will start in that location next time it is run. Many desklets use "fake transparency", which means they take a screenshot of the desktop background and use this as the desklet's background, hence pretending that desktop is visible through the desklet (as opposed to "true transparency", often referred to as translucency, which is achieved by compositing programs like xcompmgr and the Compiz window manager). This means that any changing desktop (for example, if you run xscreensaver as your background "image") will not display correctly in the desklets. I personally use ChBg to cycle through different wallpapers, and I have found that my desklets briefy flash above any other windows whilst they are taking their new screenshots. This is annoying, especially when watching video files.