Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I generally prefer XFCE desktop environment of Xubuntu, but I found its files right-click context menu too humble (no option to compress/decompress files for example, and I'd like some my very special actions there too).

How can I customize it?

share|improve this question

3 Answers 3

up vote 2 down vote accepted

Look at these links,

share|improve this answer
    
The exact answer on my answer is actually thunar-uca (Edit - Configure custom actions). But I've found it by looking for pluguns. –  Ivan Dec 21 '10 at 12:21

The best way to do this is to use the excellent Thunar custom actions feature (now installed as default with Thunar), and as there are no detailed tutorials here I thought it was worth adding one. When a custom action is created it is added to the context menu, as I will show in my discussion below. However, you can tailor when it appears in the context menu and, for example, make sure that your custom action only appears when image files are right-clicked on.

In thunar, if you go to edit > configure custom actions, you will see the menu as below (minus my custom actions of course):

enter image description here

You can either create a new custom action (see the discussion below) or edit an existing one. There are many useful examples at the Xfce site and at the Ubuntu wiki, so there is no need to go through them all here, but we will just discuss a few examples to display the usefulness of this feature in Thunar.

You would create a new custom action by clicking the add button (shown in the first screenshot). Then you would put the below command, for example, in the command box (like I have done for a different example in screenshot 2):

zenity --question;if [ $? = 0 ];then srm -rvf %F;fi

and then make sure that the correct file types were selected in the Appearance Conditions menu (as I have done for a different example in screenshot 3).

The command above uses srm (which is in the package called secure-delete), and one should be very careful in using it on files. Hence, the GNOME dialog program, Zenity, is often used if confirmation is needed for the actions (like it was used here) so that files are not removed accidentally.

However, to use a safer example than srm, we can use the example of espeak, so that we can get espeak to read any text file to us. We would create a new custom action and then we would put in the command box (as in screenshot 2)

espeak -s 135 -f %f

Espeak needs to be installed if it isn't already (with sudo apt-get install espeak); the -s option I have used just slows down the speed of the speech a bit; you can specify other parameters as well like different voices, but the -f switch must always go before %f as it shows espeak the text input file to use.

(You can add an icon if you wish (see the screenshot below), so that the context menu looks more interesting.)

enter image description here enter image description here

Now, only when you right click a text file, will the espeak option come up, as in the screenshot below.

enter image description here

There is so much more that can be done with custom actions, but this was just an introduction to the basic ways of creating your own context menu item. There is a lot more information at the Xfce wiki and a lot of useful examples, and there are also some excellent examples of custom actions in this forum.


To restrict a command to a certain type of files:

  • only to txt: under 'Appearance conditions' tab, check 'Text files', and then add *.txt for 'File pattern'.
  • only for png: check 'Image files', and *.png for 'File pattern'.
  • only for flv: 'Video files', and *.flv.
  • for other files, like pdf: check 'Other files', and add *.pdf. etc.
share|improve this answer

Thunar plugins cover a limited area of options.

The main way to add new context menu options is (as Mik said) done by going to 'Edit/Configure custom actions' - and clicking "+" to add.

To add wine apps is more tricky. See this answer for Foobar2000 player comming also from Mik. Although the script might not work for all apps, I have tried it on 7-zip archiver too and it works.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.