在 gtk 文件选择器中显示文件系统而不是“位置”

Mar*_*ter 15 desktop desktop-environment gtk gtk3

在几乎所有程序中,当我单击 时open,将打开一个文件选择器对话框,如下所示。该对话框将显示RecentHomeDesktop等。

在此处输入图片说明

这是非常烦人的。我不是Desktop用来存储数据的,我也不关心Recent. 无论我最近打开了什么,每次出现打开的对话框时,我都希望获得一致的视图。

另外,从我的截图中可以看出,这个对话窗口是多么的愚蠢。我已经tmpfs安装在/tmp,另一个tmpfs安装在/home/<user>/tmp.

然而,在Locations列表中,这两个挂载点仅被称为tmp并且无法区分。

理想情况下,在左侧,我希望在上半部分看到我的主目录,而从/下半部分开始是简单的旧文件系统树。

或者甚至更好,只在左侧显示文件系统树,但当前位置/home/<user>/已经自动“预选”,我的内容home显示在右侧。

我可以Recent通过添加以下内容来删除.config/gtk-3.0/settings.ini

gtk-recent-files-enabled=false
Run Code Online (Sandbox Code Playgroud)

但是,桌面仍然在上半部分,而在下半部分则是随机组合的绝对混乱。

在 GTK2/GTK3 中,我怎样才能将一些顺序和逻辑带回文件选择器,如上所述?

2020 年 6 月更新:我在 Debian 10 上使用 Openbox,带有没有任何桌面环境的 GTK3 库。我也更新了截图。

小智 1

这个主题已经存在相当长一段时间了,但是一个简单的解决方案可以忽略侧边栏中不断增长的几乎无用的挂载点项目列表,但似乎仍然不存在。

作为快速修复,以下补丁禁用除主目录、用户书签和“最近”项目(如果如此配置)之外的所有位置。

也许这很有帮助。

--- gtk+3.0-3.24.24.orig/gtk/gtkplacessidebar.c
+++ gtk+3.0-3.24.24/gtk/gtkplacessidebar.c
@@ -106,6 +106,16 @@
  * - .has-open-popup when a popup is open for a row
  */
 
+/* Workaround switch for a concise places sidebar.
+ *
+ *   2023-01-05 Gundolf Kiefer <gundolf.kiefer@web.de>
+ *
+ * The following switch disables all automatically generated places from the
+ * sidebar except the home directory and the user-defined bookmarks.
+ */
+#define SHORT_SIDEBAR 1
+
+
 /* These are used when a destination-side DND operation is taking place.
  * Normally, when a common drag action is taking place, the state will be
  * DROP_STATE_NEW_BOOKMARK_ARMED, however, if the client of GtkPlacesSidebar
@@ -1097,6 +1107,8 @@ update_places (GtkPlacesSidebar *sidebar
   g_object_unref (start_icon);
   g_free (home_uri);
 
+#if SHORT_SIDEBAR == 0
+
   /* desktop */
   if (sidebar->show_desktop)
     {
@@ -1416,6 +1428,8 @@ update_places (GtkPlacesSidebar *sidebar
     }
   g_list_free (mounts);
 
+#endif    // SHORT_SIDEBAR == 0
+
   /* add bookmarks */
   bookmarks = _gtk_bookmarks_manager_list_bookmarks     (sidebar->bookmarks_manager);
Run Code Online (Sandbox Code Playgroud)