如何为 Nautilus 文件管理器设置默认打开文件夹?

tri*_*ner 15 default nautilus directory

如何将 Nautilus 配置为在我的 Documents 文件夹而不是我的主文件夹中打开?

我已经搜索了这个站点并找到了指导用户编辑/usr/share/applications/nautilus.desktop文件的答案,替换%U为所需默认目录的路径。我已经编辑nautilus.desktop了上述目录中的所有变体,但所有编辑都没有效果。我在编辑完所有文件后检查了它们,以确保我有效地保存了编辑,并且对我来说都很好。

我已将每个文件编辑为如下:

Exec=nautilus --new-window /home/judy/Documents
Run Code Online (Sandbox Code Playgroud)

org.gnome.Nautilus.desktop可以肯定的是,我还编辑了该文件,但并不高兴。

我正在运行 Ubuntu 15.10。

注意:如果我nautilus /home/judy/Documents从命令行输入,Nautilus 会在所需目录中正确打开。有没有一种简单的方法可以让我在启动器栏中配置一个图标来运行这个命令,并让 Nautilus 图标看起来像一个金属文件抽屉?

谢谢。我正在把我的头发拉到这个上面。

Lev*_*nte 6

以下是在 vanilla Ubuntu 20.04 上对我有用的内容:

\n

(值得注意的是,虽然在 UI 上该应用程序被称为“文件”,但在幕后它仍然被称为nautilus。)

\n
    \n
  1. 将正确的启动器复制到正确的位置:

    \n
    /usr/share/applications/org.gnome.Nautilus.desktop\n
    Run Code Online (Sandbox Code Playgroud)\n

    \n
    /home/<YOURUSERNAME>/.local/share/applications/\n
    Run Code Online (Sandbox Code Playgroud)\n
  2. \n
  3. 使用以下命令使副本可执行:

    \n
    chmod +x /home/<YOURUSERNAME>/.local/share/applications/org.gnome.Nautilus.desktop\n
    Run Code Online (Sandbox Code Playgroud)\n

    或通过right-clicking图标 \xe2\x86\x92属性\xe2\x86\x92权限选项卡 \xe2\x86\x92 复选框允许将文件作为程序执行

    \n
  4. \n
  5. 编辑副本:

    \n
      \n
    • 有两行以Exec=。编辑这两行,使它们看起来像这样:

      \n
      Exec=nautilus --new-window /your/desired/directory\n
      Run Code Online (Sandbox Code Playgroud)\n

      请注意,我删除了%U从行尾删除了 。

      \n
    • \n
    • 处理条目DBusActivatable(感谢L31N)。

      \n

      要么分配一个false为其赋值,要么注释掉该行,如下所示:

      \n
      # DBusActivatable=true\n
      Run Code Online (Sandbox Code Playgroud)\n

      我不知道后一步有什么副作用,我希望从长远来看不会有什么影响。

      \n
    • \n
    \n
  6. \n
  7. 重新启动或退出会话并重新登录。

    \n
  8. \n
\n

现在对我来说,当通过破折号调用和在扩展坞中单击时,它都会打开我的目录。

\n

  • 无需使 .desktop 文件可执行:可以删除步骤 2。 (2认同)

L31*_*31N 5

unity-dash 中显示的文件不再/usr/share/applications/nautilus.desktop/usr/share/applications/org.gnome.Nautilus.desktop.

更改Exec=文件本身中的行没有任何效果。问题是一个DBusActivatable=true使系统通过 dbus 运行 nautilus 的条目。所以该Exec=行被忽略。也许可以通过 dbus ( /usr/share/dbus-1/services/org.gnome.Nautilus.service) 向 nautilus 提供所需的目录,但我对该系统的细节并不熟悉。
有关更多信息,请参见此处:https://wiki.gnome.org/HowDoI/DBusApplicationLaunching

对我来说,一个简单的解决方案是隐藏 gnome/dbus 启动器图标并让旧的图标再次可见。因此,将条目添加NotShowIn=Unity;/org.gnome.Nautilus.desktop并在 中将其注释掉nautilus.desktop。在那里您可以调整Exec=所需目录的行。

(file: org.gnome.Nautilus.desktop)

[Desktop Entry]
NotShowIn=Unity;     # <--------------------------- add this line !
Name=files
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window %U
Icon=system-file-manager
Terminal=false
Type=Application
DBusActivatable=true
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
MimeType=inode/directory;application/x-gnome-saved-search;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.14.2
X-GNOME-UsesNotifications=true
Actions=Window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

#OnlyShowIn=Unity;    # <---------------- comment out this line !

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus --new-window
#OnlyShowIn=Unity;    # <---------------- comment out this line !
Run Code Online (Sandbox Code Playgroud)

(file nautilus.desktop)

[Desktop Entry]
#NotShowIn=Unity;     # <---------------- comment out this line !
Name=files
Comment=Access and organize files
Keywords=folder;manager;explore;disk;filesystem;
Exec=nautilus --new-window /{DESIRED_DIRECTORY}     # <- adjust !
Icon=system-file-manager
Terminal=false
Type=Application
StartupNotify=true
Categories=GNOME;GTK;Utility;Core;FileManager;
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=nautilus
X-GNOME-Bugzilla-Component=general
X-GNOME-Bugzilla-Version=3.14.2
X-GNOME-UsesNotifications=true
Actions=Window;
X-Unity-IconBackgroundColor=#af4853
X-Ubuntu-Gettext-Domain=nautilus

[Desktop Action Window]
Name=Open a New Window
Exec=nautilus --new-window
Run Code Online (Sandbox Code Playgroud)

  • @techraf 编辑文件后仍然没有喜悦。我很困惑为什么有这么多 nautilus 配置文件。各自做什么?我的系统有 `usr/share/applications/nautilus.desktop`、`usr/share/applications/nautilus-home.desktop` 和 `usr/share/applications/nautilus-classic.desktop` 和 `usr/share/applications /nautilus-autorun-software.desktop` 和 `usr/share/applications/nautilus-connect-server.desktop` 和 `usr/share/applications/nautilus-folder-handler.desktop` 和 `usr/share/applications/ org.gnome.Nautilus.desktop` (2认同)

Edu*_*ola -1

有一个更简单的方法:

  • 在桌面上创建一个空文件。

  • 使用文本编辑器(例如 gedit)打开它。

  • 写下以下几行:

    [Desktop Entry]
    Name="Open Nautilus in custom folder"
    Exec="nautilus /path/to/custom/folder"
    Type=Application
    
    Run Code Online (Sandbox Code Playgroud)

将其另存为nautilus_custom.desktop. 打开终端并运行:

chmod +x $HOME/Desktop/nautilus_custom.desktop
Run Code Online (Sandbox Code Playgroud)

不带引号。现在,您应该可以通过双击刚刚在桌面中创建的文件来启动自定义文件夹中的 Nautilus。