You are not logged in.

#1 2012-01-09 10:11:24

cryptkeeper
Member
From: Zurich, Switzerland
Registered: 2011-12-29
Posts: 63

open files from terminal (gnome-open doesn't work properly)

How can I open files from terminal? On Ubuntu, I used xdg-open. On Arch, I have gnome-open, but I can only open directories with that, not files directly. This sucks bucause I like navigating through my files using the terminal instead of a file manager, which doesn't make that much sense if files can't be opened directly.

Last edited by cryptkeeper (2012-01-10 14:36:42)

Offline

#2 2012-01-09 10:21:17

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: open files from terminal (gnome-open doesn't work properly)

According to https://wiki.archlinux.org/index.php/Xdg-open you should check your DE's file associations.

Offline

#3 2012-01-09 10:44:03

cryptkeeper
Member
From: Zurich, Switzerland
Registered: 2011-12-29
Posts: 63

Re: open files from terminal (gnome-open doesn't work properly)

It says there that the default applications are defined in either /usr/share/applications/default.list or ~/.local/share/applications/default.list. I don't have either of these files.

Does anyone have such a file which I could use? It's shown how the file's formatted, so I could principally create it myself, but I'd prefer having a rather complete list of filetypes, and I don't know that much about filetypes anyway...

Last edited by cryptkeeper (2012-01-09 10:44:41)

Offline

#4 2012-01-09 10:45:50

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: open files from terminal (gnome-open doesn't work properly)

gnome-open deprecated(libgnome is not even installed by default). use xdg-open or gvfs-open

you are talking about the old format, the "new' is in ~/.local/share/applications/mimeapps.list

Last edited by wonder (2012-01-09 10:46:25)


Give what you have. To someone, it may be better than you dare to think.

Offline

#5 2012-01-09 10:53:24

cryptkeeper
Member
From: Zurich, Switzerland
Registered: 2011-12-29
Posts: 63

Re: open files from terminal (gnome-open doesn't work properly)

Yes, that file I do have, though there aren't too many entries in it (I can't find one for PDFs for example). But it doesn't work. I've tried it with files for which the default application is defined in mimeapps.list, e.g. a png image. But when I do `xdg-open some-image.png`the directory containing the image is opened in the file manager, and not the file itself. sad

Last edited by cryptkeeper (2012-01-09 10:54:22)

Offline

#6 2012-01-09 12:32:41

wonder
Developer
From: Bucharest, Romania
Registered: 2006-07-05
Posts: 5,941
Website

Re: open files from terminal (gnome-open doesn't work properly)

if you cannot find pdf then is not customized and the handler is system wise.


Give what you have. To someone, it may be better than you dare to think.

Offline

#7 2012-01-10 14:34:35

cryptkeeper
Member
From: Zurich, Switzerland
Registered: 2011-12-29
Posts: 63

Re: open files from terminal (gnome-open doesn't work properly)

PDF has now been added to mimeapps.list when I set Evince as the application for PDFs in Nautilus (as @woder wrote). But when I open PDFs from other apps (specifically the BibTeX frontend Referencer), PDFs are still opened in Gimp.

Any idea how to fix this?

I've also tried out gvfs-open, but it behaves exactly the same way as gnome-open and xdg-open(*) do: it doesn't open the file but the contianing directory in Nautilus.

(*) I just read on Archwiki that xdg-open just calls gnome-open, so at least it's clear why these to behave the same...

---------------------------------------------------------------------------------------------------------------------------------------------------------------

I've tried out fixing the DE variable and put `export DE="libgnome"` into .xinitrc. That didn't change anything, and after reading the wiki page again I should've written xfce instead of libgnome to make the system think it's running XFCE so that xdg-open would call XFCE's exo-open instead of gnome-open. So I tried `exo-open logo.jpg` and what the hell, IT WORKS!!

big_smile

So now I just ust exo-open instead of xdg-open. Actually, I've written a short script as a wrapper for xdg-open anyway some time ago because xdg-open doesn't like multiple files as input, so I just had to replace xdg-open with exo-open in that script.

Now opening files from terminal works perfectly again.

Last edited by cryptkeeper (2012-01-10 14:38:37)

Offline

#8 2012-01-10 20:20:30

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: open files from terminal (gnome-open doesn't work properly)

If you want to see the syntax, here is my defaults.list (so far my Xfce installation hasn't tried to switch over to mimeapps.list):

[Default Applications]
audio/x-wav=audacity-usercreated.desktop
application/x-shockwave-flash=swfdec-player-usercreated.desktop
application/x-java-jnlp-file=java-web-start-usercreated.desktop
audio/mpeg=audacity-usercreated.desktop
application/x-bittorrent=deluge-usercreated.desktop
application/javascript=medit-usercreated.desktop
application/rdf+xml=medit-usercreated.desktop
application/zip=xarchiver-usercreated.desktop
application/x-compressed-tar=xarchiver-usercreated.desktop
video/mp4=mplayer-usercreated.desktop;xine-usercreated.desktop
text/x-agr=gracegtk-usercreated.desktop;grace-usercreated.desktop
text/html=medit-usercreated.desktop;chromium-usercreated.desktop;firefox-usercreated.desktop
image/x-xbitmap=mirage-usercreated.desktop;gimp-usercreated.desktop;medit-usercreated.desktop
application/postscript=evince-usercreated.desktop
application/x-cbr=evince-usercreated.desktop
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=gnumeric-usercreated.desktop;xarchiver-usercreated.desktop
text/plain=medit-usercreated.desktop
audio/flac=audacity-usercreated.desktop
video/x-msvideo=mplayer-usercreated.desktop;xine-usercreated.desktop
application/x-cbz=evince-usercreated.desktop
image/gif=mirage-usercreated.desktop;gimp-usercreated.desktop
application/vnd.ms-powerpoint=impress-usercreated.desktop
application/x-java-archive=xarchiver-usercreated.desktop
application/smil=kino-usercreated.desktop
application/vnd.oasis.opendocument.text=writer-usercreated.desktop
image/svg+xml=inkscape-usercreated.desktop;medit-usercreated.desktop;mirage-usercreated.desktop
video/x-flv=mplayer-usercreated.desktop
application/vnd.ms-excel=gnumeric-usercreated.desktop
application/vnd.openxmlformats-officedocument.wordprocessingml.document=writer-usercreated.desktop
application/vnd.oasis.opendocument.spreadsheet=calc-usercreated.desktop
application/x-gnumeric=gnumeric-usercreated.desktop
image/png=mirage-usercreated.desktop;gimp-usercreated.desktop
application/x-audacity-project=audacity-usercreated.desktop
video/x-ms-wmv=mplayer-usercreated.desktop;xine-usercreated.desktop
image/jpeg=mirage-usercreated.desktop;gimp-usercreated.desktop
image/bmp=mirage-usercreated.desktop;gimp-usercreated.desktop
application/msword=writer-usercreated.desktop;abiword-usercreated.desktop
video/mpeg=mplayer-usercreated.desktop;xine-usercreated.desktop
image/x-eps=evince-usercreated.desktop
application/pdf=epdfview-usercreated.desktop;evince-usercreated.desktop
application/vnd.oasis.opendocument.presentation=impress-usercreated.desktop

Obviously you probably have different app preferences than me. And you'll probably have to sed away the "-usercreated" strings because I am anal about having my own desktop file for everything.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#9 2012-01-10 20:27:37

cryptkeeper
Member
From: Zurich, Switzerland
Registered: 2011-12-29
Posts: 63

Re: open files from terminal (gnome-open doesn't work properly)

Thanks for the file, but I don't think I need it because mimeapps.list and exo-open work well together. The remaining problem is that somewhere must be another file which e.g. Referencer (as mentioned above) uses, and in there, the default application for PDFs is still Gimp (only an example, but an annoying one). It's not in /usr/share/applications/, and apart from that, I have no idea where to look for it...

Last edited by cryptkeeper (2012-01-10 20:29:02)

Offline

Board footer

Powered by FluxBB