Thunar Customize قىلىش
Prev |  | Next

## Thunar Customize قىلىش

بۇ بابتا ھۆججەت باشقۇرغۇنىڭ بىر قىسىم جايلىرىنى Customize قىلىش ئۇسۇلىنى چۈشەندۈرىمىز

### "...گە ئەۋەت" Menu

Thunar includes a Send To menu, which provides possible targets where files and folders can be sent to. To access the Send To menu, choose File → Send To from the main menu, or right-click on a file or folder and choose Send To.

By default, the Send To menu includes an entry named Desktop (Create Link) for all files and folders, which simply creates a link on the desktop for each selected file. In addition, if the Shortcuts Pane is active, the menu also includes an entry called Side Pane (Create Shortcut) for folders, which allows users to add new shortcuts to the side pane. Following these entries, `Thunar` lists the removable drives currently plugged into the computer. In the screenshot above, the Floppy Drive represents a possible target where files can be sent to. Note that the device is mounted automatically once selected from the Send To menu, so you do not need to manually mount it.

In addition `Thunar` also ships the `thunar-sendto-email` plugin, which adds the entry Mail Recipient to the menu, that opens the mail composer with the selected files attach to the new email. If the selection contains atleast one folder, the selected items are added to a ZIP archive before attaching them to the email. Otherwise, if the selection contains multiple files, or a single file, which is larger than 200Kib, the user will be prompted whether to pack the files into a ZIP archive, and send the ZIP archive.

Like most other features of `Thunar`, the Send to menu can be easily extended by users and application developers with new targets, using standard desktop entry files. These files must be installed into one of the `$XDG_DATA_DIRS/Thunar/sendto/` folders (see the XDG Base Directory Specification for details about the `$XDG_DATA_DIRS` variable).

The `MimeType` of the target `.desktop` specifies the types of files for which this action should be available in the Send To menu. For example, say you want to add entry for a Flickr uploader tool, then this entry should only show up if the selection contains JPEG files (other file formats are not supported by Flickr) and so you should add a line `MimeType=image/jpeg;`. If you do not specify any `MimeType` your entry will show up for all file types.

A complete example using the `postr` application is shown below:

    # postr.desktop - Integrate postr into
    #                 the "Send To" menu.
    [Desktop Entry]
    Type=Application
    Version=1.0
    Encoding=UTF-8
    TryExec=postr
    Exec=postr %F
    Icon=postr
    Name=Flickr
    MimeType=image/jpeg;

If you install this file to `~/.local/share/Thunar/sendto/` (create the folder if it does not exist yet), the Send To menu for JPEG files will show the new entry Flickr, which can be used to upload JPEG images to Flickr.

The Thunar Project Wiki contains additional examples of useful targets for the Send To menu. Feel free to extend the Wiki page with new examples.

### Thumbnailers

Thunar uses small utilities to create thumbnails of certain file types and displays the thumbnails as preview of the file content. These small tools are called thumbnailers. Thunar ships with thumbnailers for image and font files, and makes use of the installed thumbnailers from GNOME automatically if it was installed with support for `gconf`. Users may however dynamically extend this basic functionality with thumbnailers for additional file types.

If you plan to write a custom thumbnailers, you need to start with a program that accepts atleast two command line parameters, the input file, which is of the file type you plan to support and the output file, which is a PNG file that complies with the format specified by the Thumbnail Management Standard. Additionally your program may also accept the desired size of the thumbnail, which is optional but highly recommended. If you write the output file at an arbitrary image size, Thunar will afterwards scale it to the desired size, which might produce a less optimal result than generating the thumbnail with the requested dimensions.

Once your utility to generate the thumbnails is done, you will need to register your thumbnailer, so Thunar is able to locate and use it. Therefore all you need to do is to install a description file for the thumbnailer (a `.desktop` file) in one of the `$XDG_DATA_DIRS/thumbnailers/` paths. For example, if you want to register the thumbnailer for your user account only, you can install the file into the folder `~/.local/share/thumbnailers/`. The `.desktop` for thumbnailers has the following format.

#### Thumbnailer چۈشەندۈرۈش ھۆججىتىنىڭ فورماتى

Thumbnailer description files utilize the Desktop Entry Format with a special `Type` of `X-Thumbnailer` and special field `X-Thumbnailer-Exec` with new field codes. Basically, a thumbnailer description file has the following format.

    [Desktop Entry]
    Version=1.0
    Encoding=UTF-8
    Type=X-Thumbnailer
    Name=Your Thumbnailer
    MimeType=your-supported/mime-type;
    X-Thumbnailer-Exec=your-thumbnailer %i %o %s

The `Version` and `Encoding` are mandated by the Desktop Entry Specification, just use the values shown in the example above. The `Type` field must have the special value `X-Thumbnailer`, otherwise your thumbnailer will not be recognized. The `Name` value describes your thumbnailer.

The `X-Thumbnailer-Exec` field contains the command to run your thumbnailer, and supports certain field codes that will be substituted when the thumbnailer is run. Recognized field codes are as follows:

`%i`

  The local path to the input file for which to create a thumbnail. May be either a path relative to the directory from which the thumbnailer was invoked or an absolute path.

`%o`

  The local path to the output file where to store the generated thumbnail. The output file must be written as valid PNG file according to the thumbnail standard (see above). Note that the path may not end with `.png`, which matters if you invoke certain third party tools.

`%s`

  thumbnail نىڭ چوڭلۇقى (پىكسېل)، بۇ پارامېتىر يېزىلمىسىمۇ بولىدۇ

`%u`

  Similar to `%i`, but substituted with the URI of the file, rather than the path. This was added for compatibility with GNOME.

`%%`

  Will be substituted with a single `%`.

You need to include atleast `%o` and `%i` or `%u`, otherwise your thumbnailer will be useless.

The `MimeType` lists the MIME types - separated by semicolon - for which your thumbnailer is able to create previews.

#### EPS Thumbnailer ھەققىدىكى مىسال

This example demonstrates how to write and install a new thumbnailer for `.eps` files, which uses the convert utility that ships as part of ImageMagick. First, we start with a simple script that invokes convert to generate a thumbnail at the requested size.

    #!/bin/sh
    #
    # eps-thumbnailer - Example thumbnailer script for EPS files.
    #
    # Usage: esp-thumbnailer eps-file png-file size
    #

    # command line parameters
    ifile=$1
    ofile=$2
    size=$3

    # invoke convert (ImageMagick)
    exec convert "eps:$ifile" -scale "$sizex$size" "png:$ofile"

بۇ script `eps-thumbnailer` نى دېگەن ئاتتا ساقلاپ، ئىجرا ھوقۇقى بېرىپ، `/usr/local/bin` غا ئورنىتىلىدۇ

    $ chmod +x eps-thumbnailer
    $ sudo install eps-thumbnailer /usr/local/bin/eps-thumbnailer

كېيىنكى قەدەمدە، تۆۋەندىكىدەك thumbnail چۈشەندۈرۈش ھۆججىتى`eps-thumbnailer.desktop` نى ياساش كېرەك.

    [Desktop Entry]
    Version=1.0
    Encoding=UTF-8
    Type=X-Thumbnailer
    Name=EPS Thumbnailer
    TryExec=convert
    MimeType=image/x-eps;
    X-Thumbnailer-Exec=/usr/local/bin/eps-thumbnailer %i %o %s

بۇ ھۆججەت `/usr/local/share/thumbnailers` گە ئورنىتىلمىسا بولمايدۇ (مۇندەرىجە يوق بولسا بىرنى قۇرۇڭ).

    $ sudo install -d /usr/local/share/thumbnailers
    $ sudo install eps-thumbnailer.desktop /usr/local/share/thumbnailers/eps-thumbnailer.desktop

The `eps-thumbnailer.desktop` file uses the special key `TryExec`, which, if specified, names a command that must be present on the system for the thumbnailer to be useful. In this case, our script is useless if the convert utility is not present.

The last step is to regenerate the thumbnailer cache, so Thunar will pick up our thumbnailer. The thumbnailer cache is located at `$XDG_CACHE_HOME/Thunar/thumbnailers.cache` (unless overridden by your or your system administrator, the `$XDG_CACHE_HOME` points to the folder `~/.cache/`). The thumbnailers cache is regenerated periodically by Thunar, but you can force to regenerate it by invoking the `thunar-vfs-update-thumbnailers-cache-1` utility, that ships as part of Thunar. This utility is usually installed in the `libexec` subfolder of your installation prefix (`sbin` on Debian/Ubuntu). So for example, if Thunar is installed in `/usr`, invoke the utility as follows:

    $ /usr/libexec/thunar-vfs-update-thumbnailers-cache-1

بۇ پروگراممىنى سىزنىڭ ھېساباتىڭىزدا ئىجرا قىلىسىز، ھەرگىزمۇ superuser نىڭ ھېساباتىدا ئىجرا قىلدۇرۇشقا بولمايدۇ. چۈنكى thumbnailers غەملىكى سىزنىڭ ماكان مۇندەرىجىڭىز ئىچىگە ياسالغان. بۇنىڭغا بەك دىققەت قىلىڭ

Now, if Thunar is compiled with support for file alteration monitoring (using the FAM or Gamin services), it will automatically pick up the new thumbnailers cache within a few seconds and afterwards be able to generate thumbnails using your custom thumbnailers. Otherwise you might need to completely restart Thunar to apply the changes, using

    $ Thunar -q

شۇنىڭدىن كېيىن Thunar نى قايتا قوزغىتىڭ.

#### Thumbnails تازىلاش

The generated thumbnails are stored in the folder `~/.thumbnails/` complying with the Thumbnail Management Standard. While testing a new thumbnailer, it might help to clean up the thumbnail cache using

    $ rm -rf ~/.thumbnails/

بۇنىڭ بىلەن ماكان مۇندەرىجىڭىزدە ئازراق بىكار يەر كۆپىيىدۇ. بۇ مۇندەرىجىدىكى ئۇچۇرلارنىڭ ھەممىسى سىزنىڭ سىستېمىڭىزدىكى ھۆججەتلەردىن ياسالغان بولغاچقا، ئۆچۈرۈۋەتسىڭىزمۇ سىستېمىغا تەسىرى بولمايدۇ.

Prev |  | Next
ھۆججەت باشقۇرغۇ تەڭشىكى | Home | ئالىي تېمىلار