Adding “Search in Folder” to Thunar Custom Actions

Thunar is one of the best graphical file managers I’ve used, and I say that even while I own a Directory Opus license for Windows. I have some minor quibbles like very sparsely populated default actions on files and folders, but the biggest flaw is doubtless that the breadcrumb navigation doesn’t feature all of the regular folder interactions. In any case, in this blog post I intend to show how I improve on both Thunar and GNOME Search in one fell swoop.

I’ll start with a screenshot of the desired end result. You right click on a folder, and you’re presented with the option to search for files in it.

My context menu with Search for files.

In order to add this custom action, you’ll have to configure custom actions.

Edit → Configure custom actions.

Then you click + to add a new one, or you can edit an existing action.

Choose whether to add or edit a custom action.

You can type the name that will show up in the context menu, a little description for yourself, choose a fancy icon, and under appearance conditions you can choose whether this custom action applies to a specific type of files or folders. Unfortunately this dialog can’t be resized, but since you can copy and paste it’s not too bad.

gnome-search-tool --path=%f --contains=
The Edit Action dialog.

Finally, here is the result. Note that since I started gnome-search-tool with --contains=, the option to search for files containing specific text will show by default.

GNOME Search for Files (gnome-search-tool) with Contains the text expanded by default.

You can perform similar tricks with any of these other options.

$ gnome-search-tool --help
  gnome-search-tool [OPTION...] - the GNOME Search Tool

Help Options:
  -h, --help                      Show help options
  --help-all                      Show all help options
  --help-gtk                      Show GTK+ Options
  --help-sm-client                Show session management options

Application Options:
  --version                       Show version of the application
  --named=STRING                  Set the text of "Name contains" search option
  --path=PATH                     Set the tet of "Look in folder" search option
  --sortby=VALUE                  Sort files by one of the following: name, folder, size, type, or date
  --descending                    Set sort order to descending, the default is ascending
  --start                         Automatically start a search
  --contains=STRING               Select and set the "Contains the text" search option
  --mtimeless=DAYS                Select and set the "Date modified less than" search option
  --mtimemore=DAYS                Select and set the "Date modified more than" search option
  --sizemore=KILOBYTES            Select and set the "Size at least" search option
  --sizeless=KILOBYTES            Select and set the "Size at most" search option
  --empty                         Select the "File is empty" search option
  --user=USER                     Select and set the "Owned by user" search option
  --group=GROUP                   Select and set the "Owned by group" search option
  --nouser                        Select the "Owner is unrecognized" search option
  --notnamed=STRING               Select and set the "Name does not contain" search option
  --regex=PATTERN                 Select and set the "Name matches regular expression" search option
  --hidden                        Select the "Show hidden and backup files" search option
  --follow                        Select the "Follow symbolic links" search option
  --mounts                        Select the "Exclude other filesystems" search option
  --display=DISPLAY               X display to use

Also see

CommentsTags: ,

Launcher with parameters in Xfce

Back in November I decided to try Aard 2 on my laptop. I followed the instructions and it worked. Then I created a launcher with the following command and suddenly it did not.

java -Dslobber.browse=true -jar ~/programs/aard2/aard2-web-0.7.jar ~/programs/aard2/slobs/*.slob

A different strategy, passing a command to Bash, did the trick.

bash -c "java -Dslobber.browse=true -jar ~/programs/aard2/aard2-web-0.7.jar ~/programs/aard2/slobs/*.slob"

Enjoy your fully functional launcher! 😉

CommentsTags: ,