LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 05-29-2007, 10:16 AM   #1
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
how do i add context menu item in gnome/nautilus.


Does anyone know how I can add a menu item in Gnome from the right mouse click operation inside nautilus.

In other words, I'm inside nautilus. Select a file of type "mpeg". Right click it. I want a menu item to appear with "Convert to DVD..". Can I do this, how? Also, how do I attach a script to the menu item.

Thanks in advance.
 
Old 05-30-2007, 07:27 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Just create a script (or a link to a script) in ~/.gnome2/nautilus-scripts/ and it will appear in the right-click scripts sub-menu.
 
Old 05-31-2007, 06:01 AM   #3
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by macemoneta
Just create a script (or a link to a script) in ~/.gnome2/nautilus-scripts/ and it will appear in the right-click scripts sub-menu.
Thanks what arguments are passed into a script this way?

What I REALLY wanted was a context sensitive right-click menu with discrete individual options rather than a set of option off a "scripts" tree. In other words, if i right click on an AVI file then I can select "Convert" from the menu. If I right click on a TXT file then "Convert" does not appear.

Can I do this?
 
Old 05-31-2007, 08:55 AM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
The script is called with the name(s) of the selected files/folders. The current working directory (pwd) that the script is invoked from will be the one the script executes from.

Unfortunately, you can't create a context sensitive menu, but you can group scripts in subdirectories to separate functions (which will appear as sub-menus in the the scripts menu).
 
Old 05-31-2007, 10:16 AM   #5
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by macemoneta
The script is called with the name(s) of the selected files/folders. The current working directory (pwd) that the script is invoked from will be the one the script executes from.

Unfortunately, you can't create a context sensitive menu, but you can group scripts in subdirectories to separate functions (which will appear as sub-menus in the the scripts menu).
Ah. Great. That will do the job then

Thanks buddy.
 
Old 06-03-2007, 05:34 AM   #6
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Original Poster
Rep: Reputation: 30


I've created the following script under ~/.gnome2/nautilus-scripts
Code:
#!/bin/bash
for uri in $NAUTILUS_SCRIPT_SELECTED_URIS;
do gnome-sudo "gnome-open $uri" &
done
and yet it does not appear on the right-lick menu of nautilus folders.

I've chmod +x on the file but still no joy.

Tried logging out too. No joy.

Ideas???

Thanks.
 
Old 06-03-2007, 09:42 AM   #7
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
The nautilus scripts function appears to be a little picky about the interpreter. You can get around the problem by moving the script to your ~/bin/ directory, then creating a symlink to it in the ~/.gnome2/nautilus-scripts/ directory. For example:

cd ~/.gnome2/nautilus-scripts/
mv Convert ~/bin/
ln -s ~/bin/Convert ./
 
Old 06-03-2007, 10:48 AM   #8
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by macemoneta
The nautilus scripts function appears to be a little picky about the interpreter. You can get around the problem by moving the script to your ~/bin/ directory, then creating a symlink to it in the ~/.gnome2/nautilus-scripts/ directory. For example:

cd ~/.gnome2/nautilus-scripts/
mv Convert ~/bin/
ln -s ~/bin/Convert ./
thanks. it works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a new item to Gnome menu TruongAn Linux - Software 1 05-29-2005 01:53 AM
add a menu item in gnome... jkassemi Linux - Newbie 1 03-31-2005 11:38 PM
Can't add menu item in FC2 Pontius Linux - Software 2 09-04-2004 01:31 PM
Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.2 After Upgrade metoome General 0 03-27-2004 12:19 AM
Cannot Change GNOME Menu Items to add/change Item for Mozilla 1.3 After Upgrade SForsgren Linux - General 4 03-26-2004 11:43 PM


All times are GMT -5. The time now is 08:56 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration