16

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?

3
  • 1
    Have a look here. This solves your problem. Oct 27, 2011 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, Oct 31, 2011 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 Oct 31, 2011 at 18:25

4 Answers 4

10

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)
1
  • This could work as a workaround but I rather prefer "the old way" that you could add a command directly. Feb 28, 2012 at 22:10
2

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
3
  • good solution! Although I haven't tested it Sep 25, 2012 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, 2012 at 8:14
  • Done. Github can now close :-) Oct 17, 2012 at 10:53
1

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.

0

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 .
1
  • Welcome to AskUbuntu. Can you provide detail how to install Thunar? Edit your answer with extra detail. Thanks!
    – penreturns
    Oct 8, 2012 at 10:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .