GNOME (简体中文)/Files (简体中文) - ArchWiki

Jump to content
< GNOME (简体中文)

本文或本节需要翻译。要贡献翻译，请访问简体中文翻译团队。

附注： This page is partially translated.（在 Talk:GNOME (简体中文)/Files (简体中文)# 中讨论）

Related articles

- GNOME (简体中文)
- File manager functionality (简体中文)
- Nemo
- Thunar
- PCManFM (简体中文)

翻译状态：本文是 GNOME/Files 的翻译。上次翻译日期：2022-04-19。如果英文版本有所更改，则您可以帮助同步翻译。

文件是GNOME的默认文件管理器。文件的目的是提供一种管理文件和应用的简化方法。

Note: 在3.6版本之前，文件叫做Nautilus，后来则对每种语言做了新的描述性名称。Nautilus这个名字仍然用在许多地方，如可执行文件名、软件包名、桌面条目和GSettings Schema等。

## 安装

安装nautilus软件包，此软件包是gnome组的一部分。见File manager functionality (简体中文)#附加功能[损坏的链接：无效的章节]。

Note: 文件不依赖gnome-shell，只需要gnome-desktop。

### 扩展

一些程序可以为文件增加额外的功能，例如下面这些来自官方软件仓库和AUR的软件包。

Note: 用Python编写的扩展需要Nautilus扩展API的Python绑定（python-nautilus包）。

- File Manager Actions — Configures programs to be launched when files are selected in Nautilus (written in C)

  https://gitlab.gnome.org/GNOME/filemanager-actions || filemanager-actions

- Folder Color — A file browser extension for choosing the color of a folder (written in Python)

  https://foldercolor.tuxfamily.org/ || folder-color-nautilusAUR
  Tip: This extension works only with these icon-themes which contain additional colored icons, eg:
  numix-icon-theme-gitAUR, vibrancy-colorsAUR, humanity-icon-themeAUR, mint-x-iconsAUR

- Nautilus Admin — Add to menu: "Open as administrator" or "Edit as administrator" (written in Python)

  https://github.com/brunonova/nautilus-admin || nautilus-adminAUR

- Nautilus Annotations — Annotate files and directories (written in C)

  https://gitlab.gnome.org/madmurphy/nautilus-annotations/ || nautilus-annotationsAUR

- Nautilus Bluetooth — Add to menu: "Send via Bluetooth" (written in C)

  https://gitlab.gnome.org/madmurphy/nautilus-bluetooth/ || nautilus-bluetoothAUR

- Nautilus Git — Nautilus/Nemo extension to add important information about the current git directory (written in Python)

  https://github.com/bilelmoussaoui/nautilus-git || nautilus-ext-gitAUR

- Nautilus Hide — Add to menu: "Hide"/"Unhide" (written in C)

  https://gitlab.gnome.org/madmurphy/nautilus-hide/ || nautilus-hideAUR

- Nautilus Launch — Nautilus extension to run executables and launchers via right-click menu (written in C)

  https://gitlab.gnome.org/madmurphy/nautilus-launch || nautilus-launchAUR

- Nautilus Metadata Editor — Nautilus extension with simple Metadata Editor for the following mime types: `audio/x-mp3`, `audio/x-flac`, `audio/x-vorbis+ogg`, `audio/x-speex+ogg`, `audio/x-musepack`, `audio/x-wavpack`, `audio/x-tta`, `audio/x-aiff`, `audio/m4a`, `video/mp4`, `video/x-ms-asf` (written in C and Vala)

  https://gitlab.com/nvlgit/nautilus-metadata-editor-extension || nautilus-metadata-editorAUR

- Nautilus SendTo — Files context menu for sending files (written in C)

  https://gitlab.gnome.org/Archive/nautilus-sendto || nautilus-sendto

- Nautilus Share — Nautilus extension to share folder using Samba (written in C)

  https://gitlab.gnome.org/Archive/nautilus-share || nautilus-share

- Nautilus Terminal — Terminal embedded in Files. It is always open in the current folder, and follows the navigation (written in Python)

  https://projects.flogisoft.com/nautilus-terminal/ || nautilus-terminal

- Nautilus Wipe — Nautilus extension to provide wiping integration (written in C)

  https://wipetools.tuxfamily.org/nautilus-wipe.html || nautilus-wipeAUR

- Seahorse Nautilus — PGP encryption and signing for Files (written in C)

  https://gitlab.gnome.org/GNOME/seahorse-nautilus || seahorse-nautilus

提示： 若要编写新的扩展，辅助脚本nextgenAUR可以让您轻松地设置GNOME文件的新扩展项目（默认使用C语言）。

#### 安装自己Nautilus扩展的应用程序

以下应用默认安装自己的扩展，从而将其功能集成于Nautilus。

- EasyTAG — EasyTAG is a simple application for viewing and editing tags in audio files; it supports MP3, MP2, MP4/AAC, FLAC, Ogg Opus, Ogg Speex, Ogg Vorbis, MusePack, Monkey's Audio, and WavPack files and works under Linux or Windows — The application includes a "Nautilus EasyTAG" extension (written in C)

  https://wiki.gnome.org/Apps/EasyTAG || easytag

- Brasero — CD/DVD mastering tool — The application includes a "Nautilus Brasero" extension (written in C)

  https://wiki.gnome.org/Apps/Brasero || brasero

- Eiciel — GNOME file ACL editor — The application includes an "Eiciel Nautilus" extension that add graphical ACL editor into the file properties window (written in C++)

  https://rofi.roger-ferrer.org/eiciel/ || eicielAUR

- Evince — Document viewer (PDF, PostScript, XPS, djvu, dvi, tiff, cbr, cbz, cb7, cbt) — The application includes an "Evince Properties Page" extension for Nautilus (written in C)

  https://wiki.gnome.org/Apps/Evince || evince

- File Roller — An application for browsing archives — The application includes a "Nautilus FileRoller" extension (written in C)

  https://wiki.gnome.org/Apps/FileRoller || file-roller

- GNOME Terminal — The GNOME Terminal Emulator — The application includes a "Terminal Nautilus" extension (written in C)

  https://wiki.gnome.org/Apps/Terminal || gnome-terminal

- Tilix — A tiling terminal emulator for GNU/Linux using GTK+ 3 — The application includes an extension for Nautilus which adds an "Open in Tilix" option to the context menu (written in Python)

  https://github.com/gnunn1/tilix || tilix
  Note: "Open in Tilix"扩展将python-nautilus软件包标记为可选依赖，但必须安装才能使用。

#### 依赖非自由软件的扩展

一些GNOME 文件的扩展虽然免费/自由，但可能依赖于非自由软件，例如：

- Code Nautilus — 用来在Visual Studio Code中打开文件和目录的Nautilus扩展（用Python编写）

  https://github.com/cra0zy/code-nautilus || code-nautilus-gitAUR

- JetBrains Nautilus — Nautilus extension to open files and directories in JetBrains Toolbox installed products (written in Python)

  https://github.com/encounter/jetbrains-nautilus || jetbrains-nautilus-gitAUR

## 配置

文件很容易进行图形化配置，但并非所有选项都能在首选项中找到。更多选项可以使用dconf-editor在`org.gnome.nautilus`中找到。

Note: 如果在GNOME桌面环境之外使用文件，则必须确保`/usr/lib/gsd-xsettings`正在运行，否则dconf设置不会在文件中应用。

### 桌面图标

见GNOME#Icons on the desktop[损坏的链接：无效的章节]。

### 改变默认项目视图

设置`default-folder-viewer`变量可以改变项目的默认视图，如设为列表视图：

    $ gsettings set org.gnome.nautilus.preferences default-folder-viewer 'list-view'

### 按类型排序

若要默认用类型排序所有文件夹中的文件：

    $ gsettings set org.gnome.nautilus.preferences default-sort-order 'type'

### 从侧边栏移除文件夹

`~/.config/user-dirs.dirs`中指定了侧边栏显示的文件夹，可以用文本编辑器修改。执行`xdg-user-dirs-update`会改变文件，因此最好将文件权限设为只读。

### 始终显示文本文件路径

文件工具栏默认显示用于路径导航的按钮栏界面。若要用键盘输入路径，则需按`Ctrl+l`显示文本路径栏。

若要始终以文本路径栏显示，可以使用以下gsettings命令：

    $ gsettings set org.gnome.nautilus.preferences always-use-location-entry true

Note: 改变此设置后将无法再显示按钮栏，只有把值设为false时才能同时使用两种路径栏。

## 提示与技巧

### 缩略图

见File manager functionality (简体中文)#缩略图预览[损坏的链接：无效的章节]。

Note: 在linux-hardened中，缩略图会生成失败（所有缩略图都在`~/.cache/thumbnails/fail/`目录中），这是由于非特权用户的命名空间因为安全原因在该内核上默认禁用。Nautilus使用`bwrap` (由bubblewrap提供)对缩略图进行沙盒处理。可以用bubblewrap-suid替换bubblewrap。详见Security#Sandboxing applications。

有时会无法显示视频缩略图。若要解决此问题（正如No video thumbnails on nautilus），必须安装ffmpegthumbnailer、gst-libav、gst-plugins-ugly并移除`~/.cache/thumbnails/fail/`里的内容。

### 用右键菜单创建新文档

若要使用此选项，请在您的主文件夹中创建一个`~/Templates/`（模板）文件夹，并通过终端`touch ~/Templates/new`或任何文件管理器在该文件夹中放置一个空文件，然后重新启动文件。

在非英语系统中，模板目录的名称可能不同。可以用`xdg-user-dir TEMPLATES`找到实际目录。

可以在`~/.config/user-dirs.dirs`文件中配置模板目录。

    XDG_TEMPLATES_DIR="$HOME/some/path"

### 隐藏文件

GNOME文件和大部分文件管理器一样，默认隐藏名称以“.”开头的文件。

GNOME Files additionally hides files when their names are listed in a `.hidden` file in the same directory (one filename per line). See nautilus-hideAUR for an extension that facilitates adding/removing entries from such `.hidden` files.

### 在Tilix中打开当前路径

If you are using tilix terminal you can easily add "Open in Tilix" option to the context menu of GNOME Files by installing its optional dependency python-nautilus.

### 将文件夹加入书签

若要将文件夹添加到你的书签中，只需在Nautilus中打开该文件夹，并按`Ctrl+d`。请注意，书签列表与其它基于GNOME的图形化文件管理器（如Nemo）共享，因此在其中增减的文件夹也会影响到其它文件管理器中的书签。

### 自定义脚本

位于`~/.local/share/nautilus/scripts`的脚本可以运行于文件的右键关联菜单。

The context menu can also be organized into subfolders, e.g. `~/.local/share/nautilus/scripts/images` and `~/.local/share/nautilus/scripts/music`.

Scripts have access to the following environment variables:

    NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
    NAUTILUS_SCRIPT_SELECTED_URIS
    NAUTILUS_SCRIPT_CURRENT_URI
    NAUTILUS_SCRIPT_WINDOW_GEOMETRY

一些脚本示例:

    ~/.local/share/nautilus/scripts/open-terminal-here

    #!/bin/sh
    gnome-terminal

    ~/.local/share/nautilus/scripts/remove-extension

    #!/bin/sh
    echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | while read -r filename; do
        mv -n "$filename" "${filename%.*}"
    done

Note: Make sure the scripts are marked as executable. You may have to restart nautilus with `nautilus -q` for them to show up.

#### Keybinds

Keybinds to execute scripts can be assigned in the `~/.config/nautilus/scripts-accels` file:

    ; Example Keybinds
    ; Modifiers: <Control> <Alt> <Shift>
    F4 open-terminal-here
    <Alt>x remove-extension

Note: You cannot overwrite any pre-existing nautilus keybinds.

## 疑难解答

### 文件已不再是默认文件管理器

这可能是因为重置了路径的文件关联，安装anjutaAUR往往会造成这种情况。

若要解决此问题，打开文件，右键点击一个文件夹，然后选择使用其它程序打开 > 文件 > 选择，就会把路径的关联设回文件。

若没有解决此问题，见File manager functionality (简体中文)#目录未在文件管理器中打开[损坏的链接：无效的章节]。

### 每次复制操作后都会卡几秒

如果系统中安装了kdeconnect，问题可能来自其文件共享模块，停用文件共享即可。

### 打不开Google Drive

可能是因为没有全部安装以下软件包：

- gnome-online-accounts
- gvfs-goa
- gvfs-google

全部安装即可。

Categories:

- File managers (简体中文)
- GNOME (简体中文)

Hidden categories:

- Pages or sections flagged with Template:Translateme (简体中文)
- Pages with broken section links