PCManFM (简体中文) - ArchWiki

# PCManFM (简体中文)

From ArchWiki

Related articles

- LXDE_(简体中文)
- Openbox_(简体中文)
- File manager functionality_(简体中文)
- SpaceFM
- Thunar_(简体中文)
- GNOME Files
- Nemo

翻译状态： 本文是英文页面 PCManFM 的翻译，最后翻译时间：2017-11-07，点击这里可以查看翻译后英文页面的改动。

PCManFM 是一个开源的文件管理器，并且是 LXDE的默认文件管理器。

## 安装

从仓库中选择 pcmanfm 安装，如果想安装gtk3版本，选择 pcmanfm-gtk3；如果想安装开发版，选择 pcmanfm-gitAUR。 推荐安装gvfs以提供回收站功能；推荐安装 udisks 实现远程文件系统的挂载支持。

如果你想安装Qt版本，可以选择 pcmanfm-qt 或 pcmanfm-qt-gitAUR.

## 桌面管理

使用如下命令，能够使用PCManFM进行桌面管理，比设置壁纸，桌面图标等：

    pcmanfm --desktop

原生的桌面管理菜单会被PCManFM提供的桌面管理菜单所替换。但是，只需要在桌面右击，选择 `桌面偏好设置`，在 `高级`选项卡中选择 `右击时选择窗口管理器提供的菜单`，即可还原。或者在命令行中输入：

    pcmanfm --desktop-off

即可关闭

### 桌面首选项

如果你使用的是原生的桌面管理器，只要输入下面命令就能进入修改桌面配置

    $ pcmanfm --desktop-pref

可以考虑把这句命令添加快捷键等方式，以方便使用。

### 新建图标

User content such as text files, documents, images and so forth can be dragged and dropped directly onto the desktop. To create shortcuts for applications it will be necessary to copy their `.desktop` files to the `~/Desktop` directory itself. Do not drag and drop the files there as they will be moved completely. The syntax of the command to do so is:

    cp /usr/share/applications/<name of application>.desktop ~/Desktop

For example - where installed - to create a desktop shortcut for lxterminal, the following command would be used:

    cp /usr/share/applications/lxterminal.desktop ~/Desktop

For those who used the XDG user directories program to create their `$HOME` directories no further configuration will be required.

## 守护进程模式

如果你想在后台运行PCManFM ( 比如说要自动挂载移动硬盘等可移动介质)，使用：

    pcmanfm -d

如果自动挂载失败，请参见 udisks.

## 开机自启

How PCManFM may be autostarted as a daemon process or to manage the desktop for a standalone window manager will depend on the window manager itself. For example, to enable management of the desktop for Openbox, the following command would be added to the `~/.config/openbox/autostart` file:

    pcmanfm --desktop &

Review the relevant wiki article and/or official home page for a particular installed or intended window manager. Should a window manager not provide an autostart file, PCManFM may be alternatively autostarted by editing one or both of the following files:

- xinitrc: When using the SLiM display manager or Startx command
- xprofile: When using a display manager such as LXDM or LightDM

## 额外特色与功能

Less experienced users should be aware that a file manager alone - especially when installed in a standalone Window manager such as Openbox - will not provide the features and functionality users of full desktop environments such as Xfce and KDE will be accustomed to. Review the file manager functionality article for further information.

## 提示与技巧

### 为其他文件生成缩略图

This article or section is a candidate for merging with File manager functionality#Thumbnail Previews.

Notes: This section is not specific to PCManFM. (Discuss in Talk:PCManFM (简体中文)#)

PCManFM supports image thumbnails out of the box. However, in order to view thumbnails of other file types, PCManFM uses the information provided in the files located at `/usr/share/thumbnailers`. The packages which provide a thumbnailer usually add the corresponding .thumbnail file at `/usr/share/thumbnailers`. For example, in order to get thumbnails for OpenDocument files, you may install libgsf from the official repositories. For video files' thumbnails, the package ffmpegthumbnailer is required. For PDF files, you may install evince from the official repositories, which provides `evince-thumbnailer` and the corresponding file at `/usr/share/thumbnailers`. However, if you prefer not to install `evince`, you can also replicate the functionality of `evince-thumbnailer` using imagemagick's `convert` command. This is accomplished by creating a new file with the .thumbnailer extension (e.g.: `imagemagick-pdf.thumbnailer`) at `/usr/share/thumbnailers` with the following content:

      [Thumbnailer Entry]
      TryExec=convert
      Exec=convert %i[0] -thumbnail %s %o
      MimeType=application/pdf;application/x-pdf;image/pdf;

Note: The [0] next to the input file is specified so that `convert` only generates a thumbnail of the first page. This is a `convert`-specific syntax and has nothing to do with the syntax of the thumbnailers' files.

Following this example, you can specify custom thumbnailers by creating your own .thumbnail files. Keep in mind that `%i` refers to the input file (the file which will have its thumbnail made), `%o` to the output file (the thumbnail image) and `%s` to the size of the thumbnail. These parameters will be automatically substituted with the corresponding data and passed to the thumbnailer program by PCManFM.

Tip: If you only get thumbnails of certain files and not of all the files of the same type try increasing the maximum file size of the files that get a thumbnail at Edit > Preferences > Display.

### 设置终端模拟器

You can configure what terminal emulator PCManFM should use for Tools > Open Current Folder in Terminal under Edit > Preferences > Advanced e.g. `bash -c 'pantheon-terminal --working-directory "$PWD"'`.

### 集成归档管理器

可以在编辑 > 偏好设置 > 高级 中设置集成的归档管理器。目前 PCManFM 支持 file-roller, xarchiver (或者 xarchiver-gtk2), engrampa, ark 和 squeeze-gitAUR。

### 创建模板

模板文件保存在 `~/Templates` ，点击文件>新建...可以选择相应的模板

## 故障排除

### 启动窗口空白

如果你启动应用时，界面一片空白，那么你可以试着卸载 gnome-menus 然后安装 lxmenu-data。此外，设置如下环境变量：

    export XDG_MENU_PREFIX=lxde-
    export XDG_CURRENT_DESKTOP=LXDE

### 无 "Applications"

You can try this method: Delete all files in the `$HOME/.cache/menus` directory, and run PCManFM again.

PCManFM requires the environment variable XDG_MENU_PREFIX to be set. The value of the variable should match the beginning of a file present in the `/etc/xdg/menus/` directory. E.g. you can set the value in your `.xinitrc` file with the line:

    export XDG_MENU_PREFIX="lxde-"

See these threads for more informations: [1], and especially this post from the Linux Mint forums: [2]

### 无图标

If you are using a window manager instead of a desktop environment and you have no icons for folders and files, specify a GTK+ icon theme.

If you have e.g. oxygen-icons installed, edit `~/.gtkrc-2.0` or `/etc/gtk-2.0/gtkrc` and add the following line:

    gtk-icon-theme-name = "oxygen"

Note: All instances of PCManFM have to be restarted for changes to apply!

Else, use an different one (gnome, hicolor, and locolor do not work). To list all installed icon themes:

    $ ls ~/.icons/ /usr/share/icons/

If none of them is suitable, install one. To list all installable icon packages:

    $ pacman -Ss icon-theme

Tip: For an alternative GUI solution, install lxappearance and apply an icon theme from there.

### 无 "上一/下一 文件夹"

A method to fix this is with Xbindkeys.

Install xbindkeys, xvkbd and edit `~/.xbindkeysrc` to contain the following:

    # Sample .xbindkeysrc for a G9x mouse.
    "/usr/bin/xvkbd -text '\[Alt_L]\[Left]'"
     b:8
    "/usr/bin/xvkbd -text '\[Alt_L]\[Right]'"
     b:9

Actual button codes can be obtained with package xorg-xev.

Add:

    xbindkeys &

to your `~/.xinitrc` to execute xbindkeys on log-in.

### --desktop parameter not working or crashing X-server

Make sure you have ownership and write permissions on `~/.config/pcmanfm`.

Setting the wallpaper either by using the `--desktop-pref` parameter or editing `~/.config/pcmanfm/default/pcmanfm.config` solves the problem.

### 终端模拟器的高级配置无法保存

Make sure you have rights on libfm configuration file:

    $ chmod -R 755 ~/.config/libfm
    $ chmod 644 ~/.config/libfm/libfm.conf

### Make PCManFM remember your preferred Sort Files settings

You can use View > Sort Files to change the order in which PCManFM lists the files, but PCManFM won't remember that the next time you start it. To make it remember, go to Edit > Preferences and close. That will write your current sort_type and sort_by values into `~/.config/pcmanfm/LXDE/pcmanfm.conf`.

### 挂载驱动时候提醒"Not authorized"

Make this polkit rule in `/etc/polkit-1/rules.d/00-mount-internal.rules`:

    polkit.addRule(function(action, subject) {
       if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" &&
          subject.local && subject.active && subject.isInGroup("storage")))
          {
             return polkit.Result.YES;
          }
    });

And add your user to storage group:

    # usermod -aG storage username

### Operation not supported

See the General troubleshooting article on Session permissions.

Category:

- File managers (简体中文)

Hidden category:

- Pages or sections flagged with Template:Merge