GNOME/文件

出自 Arch Linux 中文维基

文件GNOME的默認文件管理器。文件的目的是提供一種管理文件和應用的簡化方法。

注意: 在3.6版本之前,文件叫做Nautilus,後來則對每種語言做了新的描述性名稱。Nautilus這個名字仍然用在許多地方,如可執行文件名、軟件包名、桌面條目和GSettings Schema等。


安裝[編輯 | 編輯原始碼]

安裝nautilus軟件包,此軟件包是gnome包組組的一部分。見File manager functionality#附加功能[損壞的鏈接:無效的章節]

注意: 文件不依賴gnome-shell,只需要gnome-desktop

擴展[編輯 | 編輯原始碼]

一些程序可以為文件增加額外的功能,例如下面這些來自官方軟件倉庫和AUR的軟件包。

注意: 用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
提示: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 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
注意: "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-editororg.gnome.nautilus中找到。

注意: 如果在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
注意: 改變此設置後將無法再顯示按鈕欄,只有把值設為false時才能同時使用兩種路徑欄。

提示與技巧[編輯 | 編輯原始碼]

縮略圖[編輯 | 編輯原始碼]

File manager functionality#縮略圖預覽[損壞的鏈接:無效的章節]

注意:linux-hardened中,縮略圖會生成失敗(所有縮略圖都在~/.cache/thumbnails/fail/目錄中),這是由於非特權用戶的命名空間因為安全原因在該內核上默認禁用。Nautilus使用bwrap (由bubblewrap提供)對縮略圖進行沙盒處理。可以用bubblewrap-suid替換bubblewrap。詳見Security#Sandboxing applications

有時會無法顯示視頻縮略圖。若要解決此問題(正如No video thumbnails on nautilus),必須安裝ffmpegthumbnailergst-libavgst-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
注意: 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
注意: You cannot overwrite any pre-existing nautilus keybinds.

疑難解答[編輯 | 編輯原始碼]

文件已不再是默認文件管理器[編輯 | 編輯原始碼]

這可能是因為重置了路徑的文件關聯,安裝anjutaAUR往往會造成這種情況。

若要解決此問題,打開文件,右鍵點擊一個文件夾,然後選擇使用其它程序打開 > 文件 > 選擇,就會把路徑的關聯設回文件。

若沒有解決此問題,見File manager functionality#目錄未在文件管理器中打開[損壞的鏈接:無效的章節]

每次複製操作後都會卡幾秒[編輯 | 編輯原始碼]

如果系統中安裝了kdeconnect,問題可能來自其文件共享模塊,停用文件共享即可。

打不開Google Drive[編輯 | 編輯原始碼]

可能是因為沒有全部安裝以下軟件包:

全部安裝即可。