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?

cweiske
  • 3,307
  • 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

4 Answers4

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)
cweiske
  • 3,307
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
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.

Ian H
  • 11
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 .
lebatsnok
  • 143
  • 1
  • 7
Z.K.
  • 9
  • Welcome to AskUbuntu. Can you provide detail how to install Thunar? Edit your answer with extra detail. Thanks! – penreturns Oct 08 '12 at 10:34