Unfortunately, it does not let you search the file by typing a sub-string that appears in the middle of the file name. For example, typing "down" will select "Downloads", but typing "loads" will not, even though "loads" appears in the string.
Luckily, there is a way to change that, but it requires patching the source code of libfm, which is used by PCManFM. So, if you have Debian, download the source code and build dependencies:
apt-get source libfm
sudo apt-get build-dep libfm
After that, apply this patch: commit 437943e1ba9a43cd1809a1957d221a44fb22e02f
Author: sashoalm <sashoalm@aspire>
Date: Sun Feb 23 12:45:09 2014 +0200
Enable mid-string search in PCManFM.
diff --git a/src/gtk/exo/exo-icon-view.c b/src/gtk/exo/exo-icon-view.c
index 8cf6279..1131580 100644
--- a/src/gtk/exo/exo-icon-view.c
+++ b/src/gtk/exo/exo-icon-view.c
@@ -453,7 +453,7 @@ static void exo_icon_view_search_preedit_changed (GtkIMContext *im_cont
#endif
static gboolean exo_icon_view_search_start (ExoIconView *icon_view,
gboolean keybinding);
-static gboolean exo_icon_view_search_equal_func (GtkTreeModel *model,
+gboolean exo_icon_view_search_equal_func (GtkTreeModel *model,
gint column,
const gchar *key,
GtkTreeIter *iter,
@@ -8871,7 +8871,7 @@ exo_icon_view_search_start (ExoIconView *icon_view,
-static gboolean
+gboolean
exo_icon_view_search_equal_func (GtkTreeModel *model,
gint column,
const gchar *key,
@@ -8918,7 +8918,7 @@ exo_icon_view_search_equal_func (GtkTreeModel *model,
case_normalized_key = g_utf8_casefold (normalized_key, -1);
/* compare the casefolded strings */
- if (strncmp (case_normalized_key, case_normalized_string, strlen (case_normalized_key)) == 0)
+ if (strstr (case_normalized_string, case_normalized_key) != 0)
retval = FALSE;
}
diff --git a/src/gtk/exo/exo-tree-view.c b/src/gtk/exo/exo-tree-view.c
index 207cc9c..36ac5a7 100644
--- a/src/gtk/exo/exo-tree-view.c
+++ b/src/gtk/exo/exo-tree-view.c
@@ -223,11 +223,18 @@ exo_tree_view_class_init (ExoTreeViewClass *klass)
EXO_PARAM_READWRITE));
}
-
+gboolean
+exo_icon_view_search_equal_func (GtkTreeModel *model,
+ gint column,
+ const gchar *key,
+ GtkTreeIter *iter,
+ gpointer user_data);
static void
exo_tree_view_init (ExoTreeView *tree_view)
{
+ gtk_tree_view_set_search_equal_func(&tree_view->__parent__, exo_icon_view_search_equal_func, 0, 0);
+
/* grab a pointer on the private data */
tree_view->priv = EXO_TREE_VIEW_GET_PRIVATE (tree_view);
tree_view->priv->single_click_timeout_id = -1;
After that compile and install libfm:
./configure
make
sudo make install
This will install it in /usr/local/lib, and our modified libfm will be loaded by PCManFM instead of the stock that comes with Ubuntu, and is in /usr/lib.
No comments:
Post a Comment