2004.09_Context Menus-Using the Right Mouse Button to Greater Effect.pdf

(2362 KB) Pobierz
Layout 1
LINUX USER
KTools
Service, please!
A handful of service menus prove just how valuable the right mouse button
can be. We look at ways of making life with the KDE file manager easier.
BY STEFANIE TEUFEL
by adding the ability to delete any tem-
porary backup files, which many text
editors and other programs create while
working on a file, by simply clicking
with the mouse.
You may already
appreciate how impor-
tant backup files that
end with a tilde charac-
ter ( ~ ) can be, for
example, when you lose
your latest modifications
to a file for lack of a
backup. Although they
can prevent sleepless
nights, backup files have
one drawback: they can take up a lot of
your precious hard disk space.
To facilitate the simple cleanup task,
unpack the 13685-cleanbak-1.0.2.tar.bz2
package. This can be done, for example,
by typing:
Figure 2: Raiders of the lost file…
Go on to run ./install.sh , and say No ,
when asked if you want to Install the ser-
vicemenu globally? .
Your Konqueror context menu should
now have two new entries below Actions
| Clean Backup File (see
Figure 1). Clicking on
Delete backup files (*~)
will delete any files that
end with a tilde ( ~ ) in
the selected directory. But
you can opt to Move
backup files (*~) to
Tr a sh, to move them to
the trashcan just in case.
the right approach, if you want
to benefit from the huge selection
of extensions that Konqueror context
menus can offer. These otherwise hid-
den “service menus” can help you
master daily chores and make working
with your Linux desktop a much more
enjoyable experience.
Seek and Ye Shall Find
To add an Actions | Find in Folder… entry
to your file manager context menu, you
will need the 11544-find_in_folder.
desktop.tar.bz2 package from http://
www.kde-apps.org/content/download.
php?content=11544 . The package con-
tains a single file find_in_folder.desktop ,
which you just need to copy to ~/.kde/
share/apps/konqueror/servicemenus (or
$KDEDIR/share/apps/konqueror/service-
menus to make the entry available
globally).
Clicking on the entry, as shown in
Figure 2, will open the kfind program
in the current directory, thus providing
convenient file searching capabilities.
bunzip2 -c 13685-cleanbak-1.0.2 U
.tar.bz2 | tar xvf -
and changing to the directory created by
this step, cleanbak-1.0.2 . The software
comes complete with a GUI-based install
tool, which unfortunately tends to “for-
get” to create the installation directory. If
Cleanbak is the first service menu you
have created, and you need the tool for
your own personal use rather than global
access, the following line should do the
trick of creating the necessary directory:
Tidying Up
One of these items is called Clean
Backup Files . It is available as a small
7.6KBytes download from the Web
site at http://www.kde-apps.org/content/
download.php?content=13685 . Clean
Backup Files extends the context menu
Attached
Many files are just too useful, or too
pretty, to keep them all to yourself. Why
KTools
In this column we present tools, month by
month, which have proven to be especially
useful when working under KDE, solve a
problem which otherwise is deliberately
ignored, or are just some of the nicer things
in life, which – once discovered – you would
not want to do without.
mkdir ~/.kde/share/apps U
/konqueror/servicemenus
GLOSSARY
Figure 1: Cleanbak helps you get rid of unwanted
backup files at the click of the mouse.
Context menu: A menu that pops up in a
graphical user interface when the user right
clicks. The menu items change to reflect the
individual context.
74
September 2004
www.linux-magazine.com
Service Menus for Konqueror
T he right button is definitely
591352044.003.png 591352044.004.png
KTools
LINUX USER
not share, by mailing them to a good
friend? Adding the mail_as_attach-
ment.desktop file to the appropriate
servicemenu directory, allows you to
right click the file you want to mail, and
select Actions | Mail as attachment… .
This will bring up kmail with the
selected file already attached to an email
message, which you still need to write,
of course.
The attachment tool is available
as a download from http://www.
kde-apps.org/content/download.php?
content=13280 . To unpack, simply
type:
Background
If while browsing you stumble across an
image that perfectly matches your cur-
rent mood, and would thus make the
perfect background, you
can save yourself the
detour via the Control Cen-
ter by installing the Set as
background service . The
package is available as a
download from http://
www.kde-apps.org/content/
download.
php?content=12469 .
You need to unpack the archive (using
tar -xvzf 12469-setbackground.tar.gz ),
and then run the install script provided
by the developers to choose between
a global ( ./install.sh --global-install in
the setbackground directory)
or single-user installation
( ./install.sh --user-install ).
The service menu demon-
strates its “background
knowledge” when you right
click an image file. Actions |
Set as background (see Figure
5) gives you a shortcut to the
normal steps in the KDE Con-
trol Center: Appearance |
Background . You can opt to
tile the background image
( Tiled ), or you might prefer a ( Centered )
image – just click on the appropriate
menu entry, and your wish is KDE’s
command.
Figure 5: Changing the
desktop appearance.
files for example, or run system manage-
ment programs, the current user needs to
be root . There are two service menus
that prompt you for the root password
when you right click, and
switch to admin mode if
you supply appropriate cre-
dentials.
Edit as Root ( http://www.
kde-apps.org/content/down
load.php?content=11998 )
opens the selected file in
kwrite , when you click
Actions | Edit as Root , assuming that you
enter the right password in the dialog.
The fact that the archive file, called
11998-edit as SU.desktop.tar.gz , is actu-
ally a simple tar archive without gzip
compression can be confusing. So just
say tar -xvf to unpack.
The “Run As Root” service menus
( http://www.kde- apps.org/content/down
load.php?content=11227 ) follow a simi-
lar approach. The two files in the archive
open as SU.desktop and run as SU.desk-
top add two entries to the Konqueror
context menu Actions | Open as root and
Actions | Run as root .
unzip 13280-mail_as_attachment U
-0.1.zip
This will place the
mail_as_attach-
ment.desktop file in
a subdirectory called
mail_as_attachment .
If you want to
mail multiple files as
attachments, you
might prefer to
check out the Attach
to Email Service
Menu , which allows
you to attach com-
plete directories (see Figure 4 below
right). Another good thing: the tool,
which is available from http://www.
kde-apps.org/content/download.php?
content=11234 , not only works with
kmail , but with other email clients,
should you prefer to use them.
The install script included in the
11234-attach-to-email-servicemenu.tar.
bz2 archive has parameters for a global
install:
Figure 3: This useful helper makes
child’s play of mailing email
attachments.
KDE Extractor
Extract to Subdirectory , which you
can download from http://www.kde-
apps.org/content/download.php?content
=13544 , is another interesting tool.
After completing the install, you can
simply right click an archive file that
you want to upack, and select Actions |
Extract to subdirectory . This tells KDE
to create a subdirectory with the same
name, but without the extension,
and place the archive content in that
directory.
For example, this creates a direc-
tory called 11256-Make Executable
for the 11256-Make Executable.tar.bz2
archive from http://www.kde-apps.org/
content/download.php?content=11256 .
The install script provided with the
archive is only suitable for a global
install on Suse, so you might prefer to
manually copy make_executable.desktop
to the appropriate servicemenu directory
if you are using another Linux distribu-
tion.
After doing so, you can right click files
that can be made executable, and select
Action | Make file executable and Action |
Make file non-executable .
Becoming “root”
To edit some files, global configuration
./install.sh --global-install
./install.sh --local-install will restrict the
tool your own personal Konqueror con-
text menu.
If do not use Kmail, you need to select
Use a different email client below KDE
Components | Component Chooser |
Email client in the KDE Control Center,
and specify your email program of
choice. In future, whenever you select
Actions | Attach to Email , the attachment
helper will call your favorite email pro-
gram.
Figure 4: The “Attach to Email Service Menu” can
attach whole directories, and add a note to that
effect to the email message.
www.linux-magazine.com September 2004
75
591352044.005.png 591352044.006.png 591352044.001.png 591352044.002.png
Zgłoś jeśli naruszono regulamin