Xfce Forum

Sub domains
 

You are not logged in.

#1 2014-12-05 20:47:37

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

How to Disable Search(?) Box in Thunar?

I view my file system in Thunar. I type v for var. But I mistype, and actually type b. I cannot, then, simply type v (properly, this time) because some useless box has appeared in the bottom right part of Thunar, inside of which I see bv and a blinking cursor. I assume this is some sort of an abortion of a search function.

Regardless of what it is, how can I make it go away and never return?

Thanks,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#2 2014-12-06 08:53:04

Jerry3904
Member
Registered: 2013-11-09
Posts: 853

Re: How to Disable Search(?) Box in Thunar?

Why not just backspace the wrong letter(s) out of there, at which point the box disappears and you can start again? It's a tiny search box like the one in Synaptic or (in the other corner) Firefox or LibreOffice.

Not what you asked, I know...


MX-23 (based on Debian Stable) with our flagship Xfce 4.18.

Offline

#3 2014-12-06 12:28:32

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: How to Disable Search(?) Box in Thunar?

Yeah, I do that (what choice do I have?). It's just annoying... Not quite annoying enough to run a different file manager, more like one of those little things that starts out hardly annoying at all, but eventually grows to the point where it causes someone to lose both their laptop and their window.

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#4 2014-12-06 15:23:20

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,015

Re: How to Disable Search(?) Box in Thunar?

I had a quick look into this. I don't think this an Xfce or Thunar feature. I think its functionality of the GTK Treeview widget. It appears to be called "Type-Ahead Find". I've found that the widget itself contains the enable-search property which controls this functionality, but I can't seem to disable it using gtkrc hacks.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2014-12-06 15:44:55

MountainDewManiac
Member
From: Where Mr. Bankruptcy is Prez
Registered: 2013-03-24
Posts: 1,115

Re: How to Disable Search(?) Box in Thunar?

Okay, ToZ, thank you for trying. Is this Treeview thing something that I can uninstall?

Regards,
MDM


Mountain Dew Maniac

How to Ask for Help <=== Click on this link

Offline

#6 2014-12-06 19:16:04

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,015

Re: How to Disable Search(?) Box in Thunar?

Unfortunately no, its one of GTK's widgets. There must be some way to disable this functionality......

*Toz goes back and starts fiddling again*


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#7 2023-04-06 05:09:28

motomotes
Member
Registered: 2023-04-06
Posts: 3

Re: How to Disable Search(?) Box in Thunar?

This was bothering me as well, on Linux Mint 21, XFCE4, GTK3.24.33

Thanks for informing me it was the GtkTreeView, I was able to download GTK sources for my version and modify gtk/gtktreeview.c, I commented out the code to show the search box on key pressed and handled the keypress myself so it acts more like WinExplorer, where multiple keystrokes walk through the character and pressing a key goes to the first file by that key, I made it case insensitive too, this makes it easier for me to find files in large folders where I know the first character or where like I know it is the second file or third file that starts with "g" then I can just tap "ggg" to get to it quickly instead of typing the full name, like if the two files before it were "great photo" and "great prince", and I am looking for "great time".


      if (!gtk_widget_is_visible (search_window))
        { 
          //Motomotes 2023-04-05 , added Windows Explorer like function to iterate files alphabetically per key press
          /*****************************/
       
	  
          unsigned char keyVal = event->keyval;
          gboolean numlocked =  gdk_keymap_get_num_lock_state(
          			 gdk_keymap_get_for_display(
          			  gdk_display_get_default()));
                    	
          if(numlocked && (keyVal > GDK_KEY_notsign) && ((uint)keyVal < GDK_KEY_Agrave))
            keyVal = keyVal & GDK_KEY_Num_Lock;
          
          if(keyVal < GDK_KEY_exclam  || keyVal > GDK_KEY_z )
          {
          	return FALSE;
          }
          keyVal = tolower(keyVal);
          
          GtkTreeModel *tmodel = GTK_TREE_MODEL(tree_view->priv->model);
	          
      	  GtkTreeSelection *sel = gtk_tree_view_get_selection(tree_view);
      	  int n = gtk_tree_selection_count_selected_rows(sel);
      	  
      	  GtkTreeIter iter;
      	  gboolean iterate;
          int THUNAR_NAME_COL = 4;
          int index = 0;
          
      	  if( n > 0 ) {
      	    GList* paths = gtk_tree_selection_get_selected_rows(sel, &tmodel);
      	    index = gtk_tree_path_get_indices((GtkTreePath*)(paths->data) )[0];
      	    iterate = gtk_tree_model_get_iter(tmodel, &iter, (GtkTreePath*)(paths->data));
      	    g_list_free_full (paths, (GDestroyNotify) gtk_tree_path_free);
      	  } else {
      	    index = 0;
      	    iterate = gtk_tree_model_get_iter_first(tmodel, &iter);
      	  }
	  gtk_tree_selection_unselect_all(sel);
	  
	  if(!iterate){ 
	  	return FALSE;
	  }

	  gchar *str_data;
	   
          gtk_tree_model_get (tmodel, &iter,
		       		THUNAR_NAME_COL, &str_data,
			       -1);
			       
	  gboolean matched = FALSE;
	  if(keyVal == tolower(str_data[0])){
	    matched = TRUE;
	  }
	  g_free (str_data);
	  
	  iterate = gtk_tree_model_iter_next (tmodel, &iter);
	  while (iterate)
	  {
	    
	    gtk_tree_model_get (tmodel, &iter,
			       THUNAR_NAME_COL, &str_data,
			       -1);
			       
  	    iterate = gtk_tree_model_iter_next (tmodel, &iter);
  	    
	    if(matched){
	      if(keyVal != tolower(str_data[0])){
        	index--;
	      }
	      iterate = FALSE;
	    }
	    if(keyVal == tolower(str_data[0])){
	      matched = TRUE;
	      iterate = FALSE;
	    }
            g_free (str_data);
            
            index++;
	    
	 }
	 
	 if(matched){

  	   GtkTreePath *newPath = gtk_tree_path_new_from_indices(index, -1);
	   gtk_tree_selection_select_path(sel, newPath);
           gtk_tree_view_set_cursor(tree_view, newPath, NULL, FALSE);
	   gtk_tree_path_free(newPath);

	 } else {
	 
	   iterate = gtk_tree_model_get_iter_first(tmodel, &iter);
	   index = -1;

	   while (iterate)
	   {
	     
	     
	     gtk_tree_model_get (tmodel, &iter,
			        THUNAR_NAME_COL, &str_data,
			        -1);

	     iterate = gtk_tree_model_iter_next (tmodel, &iter);
	     
	     if(keyVal == tolower(str_data[0])){
	       matched = TRUE;
	       iterate = FALSE;
	     }
             g_free (str_data);
             
	     index++;
	   }
	   if(matched){

	     GtkTreePath *newPath = gtk_tree_path_new_from_indices(index, -1);
	     gtk_tree_selection_select_path(sel, newPath);
             gtk_tree_view_set_cursor(tree_view, newPath, NULL, FALSE);
	     gtk_tree_path_free(newPath);
	     
	   }
	 }
	
 	 /*****************************/
 	 
          /*GtkIMContext *im_context =
            _gtk_entry_get_im_context (GTK_ENTRY (tree_view->priv->search_entry));

          tree_view->priv->imcontext_changed = FALSE;
          gtk_im_context_filter_keypress (im_context, event);

          if (tree_view->priv->imcontext_changed)
            {
              GdkDevice *device;

              device = gdk_event_get_device ((GdkEvent *) event);
              if (gtk_tree_view_real_start_interactive_search (tree_view,
                                                               device,
                                                               FALSE))
                {
                  gtk_widget_grab_focus (GTK_WIDGET (tree_view));
                  return TRUE;
                }
              else
                {
                  gtk_entry_set_text (GTK_ENTRY (tree_view->priv->search_entry), "");
                  return FALSE;
                }
            }
	    */
        }
      else
        { ...

EDIT: I made it able to loop, made SHIFT reverse directions, and made it able to search multiple keystrokes that are less than 1 second apart. I had to add POSIX pthreads and modify the static declaration section so I have made the source available here: https://grams.motes.camp/gtktreeview.c

Last edited by motomotes (2023-04-07 20:44:30)

Offline

#8 2023-04-08 20:22:46

motomotes
Member
Registered: 2023-04-06
Posts: 3

Re: How to Disable Search(?) Box in Thunar?

motomotes wrote:

... so I have made the source available here: https://grams.motes.camp/gtktreeview.c

I changed it to only include Thunar in the special sort, and made it so it converts the SHFIT+ "." from ">" to "." so one can press SHIFT+"." to find the last hidden file\folder in the explorer.

Last edited by motomotes (2023-04-09 04:28:11)

Offline

Board footer

Powered by FluxBB