You are not logged in.

#1 2013-08-09 06:44:57

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

[solved] Gnome / Nautilus: Open With CLI programm

Hello,

How can I add CLI programs such as sxiv Image Viewer to the Open With context menu entry in Nautilus?

In particular I want to open images with sxiv by default when clicking on the image in Nautilus.

Thanks

Last edited by orschiro (2013-08-09 20:21:56)

Offline

#2 2013-08-09 15:07:31

cellisten
Member
From: Gothenburg
Registered: 2013-08-08
Posts: 30
Website

Re: [solved] Gnome / Nautilus: Open With CLI programm

What I have done (I use rox but that shouldn't make a difference) is to create a script and put that in /usr/bin.
In the script I start a new terminal (in my case guake) and run the program in that terminal:

gnome-terminal -e "sxiv '$1'"

Make sure you make the script executable. By putting it in /usr/bin it will be reachable system-wide and also tab-autocomplete

Offline

#3 2013-08-09 15:45:16

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [solved] Gnome / Nautilus: Open With CLI programm

I think the list of "Open With" applications is created by reading the ".desktop" files that are on your computer. You can read about them here. The sysem files are in "/usr/share/applications" and your personal ones are in "~/.local/share/applications". Just create a .desktop file for sxiv that uses a command similar to the one cellisten posted.

GNOME probably also has a way to create .desktop files with a GUI (I think it used to be called "alacarte").

cellisten wrote:

What I have done is to create a script and put that in /usr/bin.

Did you copy your OWN file into a directory that's controlled by pacman? yikes yikes

Offline

#4 2013-08-09 20:13:34

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: [solved] Gnome / Nautilus: Open With CLI programm

As drcouzelis pointed out, I would rather put my .desktop in ~ instead of /usr/bin. The following one works out brilliantly:

[orschiro@thinkpad ~]$ cat .local/share/applications/sxiv.desktop 
[Desktop Entry]
Name=sxiv
Comment=A Simple X Image Viewer
Exec=sxiv %f
Terminal=false
Type=Application
Icon=sxiv
Categories=GTK;Graphics;2DGraphics;Viewer;
MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-pcx;image/x-png;image/x-portable-anymap;image/x-portable-bitmap;image/x-portable-graymap;image/x-portable-pixmap;image/x-sun-raster;image/x-tga;image/x-xbitmap;image/x-xpixmap;image/svg+xml;

Offline

#5 2013-08-10 10:12:28

cellisten
Member
From: Gothenburg
Registered: 2013-08-08
Posts: 30
Website

Re: [solved] Gnome / Nautilus: Open With CLI programm

You are both completely right, I managed to find the correct place where rox stores the commands to edit them manually.

Offline

Board footer

Powered by FluxBB