NAUTILUS_SCRIPT_CURRENT_URI is set to $HOME when executing scripts from desktop

Bug #49767 reported by Nicolas Maquet
2
Affects Status Importance Assigned to Milestone
nautilus (Ubuntu)
Invalid
Low
Ubuntu Desktop Bugs

Bug Description

Binary package hint: nautilus

When I execute a nautilus script via the context menu by right-clicking on the desktop, nautilus sets the variable NAUTILUS_SCRIPT_CURRENT_URI to the value $HOME.

Shouldn't it be $HOME/Desktop instead ?

This would be more sensible IMHO.

For instance, I have a script 'Open Terminal Here' which reads :

#!/bin/bash
cd $NAUTILUS_SCRIPT_CURRENT_URI
exec gnome-terminal

Then, when I right-click on the desktop and select 'Open Terminal Here', I get a terminal with a current directory set to the home folder instead of the ~/Desktop folder.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for your bug. What version of Ubuntu do you use? That works fine for me. I just tried with that code:
"#!/bin/bash
zenity --title "NAUTILUS_SCRIPT_CURRENT_URI" --info --text "$NAUTILUS_SCRIPT_CURRENT_URI""

the URI displayed has the Desktop directory mentionned. Do you use the option to have your user directory as desktop? Note that the nautilus-open-terminal package would probably be appropriate to do that

Changed in nautilus:
assignee: nobody → desktop-bugs
importance: Untriaged → Low
status: Unconfirmed → Needs Info
Revision history for this message
Nicolas Maquet (nmaquet) wrote : Re: [Bug 49767] Re: NAUTILUS_SCRIPT_CURRENT_URI is set to $HOME when executing scripts from desktop

I use Dapper 6.06 (dist-upgraded from 5.10).

> Do you use the option to have your user directory as desktop?

What option are you referring to exactly ? I don't recall changing
such a setting ... but
maybe its an old setting from a previous version of Ubuntu (I think I
dist-upgraded twice without flushing /home).

Also, I do have a home directory seperate from the Desktop directory,
they are "/home/my_username" and "/home/my_username/Desktop"
respectively.

> Note that the nautilus-open-terminal package would probably be appropriate to do that

Thanks for the suggestion ! (But I have a bunch of other scripts for
which it is still a bit annoying like "Search Here", "Recursive Disk
Usage", etc.)

Thanks for your time !

2006/6/15, Sebastien Bacher <email address hidden>:
> Thanks for your bug. What version of Ubuntu do you use? That works fine for me. I just tried with that code:
> "#!/bin/bash
> zenity --title "NAUTILUS_SCRIPT_CURRENT_URI" --info --text "$NAUTILUS_SCRIPT_CURRENT_URI""
>
> the URI displayed has the Desktop directory mentionned. Do you use the
> option to have your user directory as desktop? Note that the nautilus-
> open-terminal package would probably be appropriate to do that
>
> ** Changed in: nautilus (Ubuntu)
> Importance: Untriaged => Low
> Assignee: (unassigned) => Ubuntu Desktop Bugs
> Status: Unconfirmed => Needs Info
>
> --
> NAUTILUS_SCRIPT_CURRENT_URI is set to $HOME when executing scripts from desktop
> https://launchpad.net/bugs/49767
>

Revision history for this message
Sebastien Bacher (seb128) wrote : Re: [Bug 49767] Re: [Bug 49767] Re: NAUTILUS_SCRIPT_CURRENT_URI is set to $HOME when executing scripts from desktop

Le jeudi 15 juin 2006 à 12:43 +0000, Nicolas Maquet a écrit :

> What option are you referring to exactly ?

gconf-editor, /apps/nautilus/preferences/desktop_is_home_dir key

Revision history for this message
Nicolas Maquet (nmaquet) wrote : Re: [Bug 49767] Re: [Bug 49767] Re: [Bug 49767] Re: NAUTILUS_SCRIPT_CURRENT_URI is set to $HOME when executing scripts from desktop

Mmmhh... I have the weirdest thing : I tried your zenity script and it works !

Displays "file:///home/username/Desktop" as expected.

Apparently its my script whose buggy :

#!/bin/bash
cd $NAUTILUS_SCRIPT_CURRENT_URI
exec gnome-terminal

But it works for every single directory I tried.... *except* ~/Desktop
Can someone try it on his desktop to see if it does the same ?
I'll look into it tomorrow.

Revision history for this message
Richard Quirk (quirky) wrote :

Your script has a bug - a URI is not the same as a directory.
cd file:///home/user/Desktop
is not the same as:
cd /home/user/Desktop
"cd" is an old skool program that knows not of URIs. Use some sed in there and it'll work:

#!/bin/bash
gnome-terminal --working-directory=$(echo $NAUTILUS_SCRIPT_CURRENT_URI | sed 's!file://!!g')

Revision history for this message
Nicolas Maquet (nmaquet) wrote : Re: [Bug 49767] Re: NAUTILUS_SCRIPT_CURRENT_URI is set to $HOME when executing scripts from desktop

Thanks for your advice, I wondered about that. The only thing I can't
figure out now is why does the above script in all situations *but*
the ~/Desktop case. When I find out I'll post it here.

Revision history for this message
Sebastien Bacher (seb128) wrote :

Nautilus works fine, you ask for an URI you get one, closing the bug as rejecting since that's not one. Feel free to reopen if you disagree

Changed in nautilus:
status: Needs Info → Rejected
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.