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.

In previous Ubuntus when you want to select/change an application to open a specific file (right-click/open with other application or properties) you were able to write a custom command to open the file. This was very useful, but now in 11.10 I can't find this option, it only shows me a list of applications and a button to look for applications in Internet.

Is there a way to restore the command line to write custom commands to open files?

share|improve this question
1  
Have a look here. This solves your problem. –  Bruno Pereira Oct 27 '11 at 20:31
    
Thank you for your answer. This certainly is a solution to my problem, but I wanted to know if there is a way to put back the GUI solution to this problem. Best regards, –  Christian Vielma Oct 31 '11 at 15:50
2  
We are all having the same issues the thing is that the change from gtk2 to gtk3 brought so many changes that at the moment ppl have to manage with some lesser solutions, further down the road I hope this will mature and not be an issue anymore :D –  Bruno Pereira Oct 31 '11 at 18:25
    
Thank you bruno! –  Christian Vielma Oct 31 '11 at 21:44
add comment

4 Answers 4

up vote 8 down vote accepted

As I found on http://blog.whatgeek.com.pt/?p=319 you can use mimeopen -d /path/to/file to configure a custom application on the cli. It will be used by gnome3 then.

$ mimeopen -d foo.matroska 
Please choose a default application for files of type application/x-matroska

    1) VLC media player  (vlc)
    2) Banshee  (banshee)
    3) Movie Player  (totem)
    4) Other...

use application #4
use command: mplayer
Opening "foo.matroska" with mplayer  (application/x-matroska)
share|improve this answer
    
This could work as a workaround but I rather prefer "the old way" that you could add a command directly. –  Christian Vielma Feb 28 '12 at 22:10
add comment

I have cooked this little script to allow our users to open a file with a program of their choice.

https://github.com/gecos-team/openwith

This package includes:

1) A little shell script that prompts you to choose a binary (using a simple Zenity dialog). This script should be named /usr/bin/openwith

#/bin/sh

DEFAULT="/usr/bin/"

FILE=`zenity --file-selection --filename=$DEFAULT --title="Open with..."`

case $? in
         0)
                "$FILE" "$1";;

esac

2) An openwith.desktop file you must place in /usr/share/applications/ so you can choose "openwith" when right-click on a file in Nautilus.

[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=application-default-icon
Name=a program of your choice...
Name[es_ES]=un programa a elegir...
Comment=Open a file with a selected program
Comment[es_ES]=Abre un archivo con el programa seleccionado
Exec=/usr/bin/openwith %f
share|improve this answer
    
good solution! Although I haven't tested it –  Christian Vielma Sep 25 '12 at 14:50
    
please improve your answer by writing solution here in case the link goes down later, it will be unusable –  user61928 Oct 3 '12 at 8:14
    
Done. Github can now close :-) –  Alfonso E.M. Oct 17 '12 at 10:53
add comment

Extending this idea, try creating .desktop files for the mimeopen -a and mimeopen -d commands. This restores the ability to open via a custom command to the right context menu, albeit you have to dig down in the menu a bit to get at it.

share|improve this answer
add comment

Install Thunar File Manager, the custom command is still there in Thunar.

To install Thunar just search it on ubuntu software centre.

(edit by lebatsnok) Thunar is included in xfce - so it works by default in xfce desktop. If you want to make thunar your default file manager but continue using another destop then the following link will give you some ideas. Installing thunar should be as easy as:

sudo apt-get update
sudo apt-get install thunar --no-install-recommends
  • Assuming that you don't want xfce .
share|improve this answer
    
Welcome to AskUbuntu. Can you provide detail how to install Thunar? Edit your answer with extra detail. Thanks! –  penreturns Oct 8 '12 at 10:34
add comment

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.