[ubuntu-us-mn] Bash script for Nautilus questions.

Tony Yarusso tonyyarusso at gmail.com
Thu Nov 12 21:48:05 GMT 2009


On Thu, Nov 12, 2009 at 3:22 PM, Fred H Olson <fholson at cohousing.org> wrote:
> The last few days I've be playing with a Bash script designed to be called
> from the Gnome file browser, Nautilus, that uses zenity to communicate
> with the user in pop up windows. This is on my Ubuntu 8.10 system, Nautilus
> 2.24.1, zenity 2.24.0.

First I will confirm that the stock script works on Ubuntu 9.10
(although it puts the links in ~/Desktop, not the current working
directory - I was briefly confused, but 'find' came to the rescue.

> After a slow start I'm making progress on the modifications to a script
> similar to what I wanted to make, but I still have a couple problems that
> are not fatal but I would like to understand / improve.
>
> 1) The original Nautilus script written by Jon Green, called
> create_symbolic_links  was downloaded from
> http://g-scripts.sourceforge.net/cat-filesysmgt.php
>
> The only zenity function Green used was:
>
>   zenity --warning \
>          --text="Some text to display in a little window"
>
> but he makes the definition (?) :
>
> warning() {
>   ${ZENITY} --warning --warning-text "$*"
>  }
>
> so he can just (I think) use the syntax:
>   warning "Some text to display in a little window"

Yes.  Additionally, there is a comment to the effect that he intends
for the script to be easily portable to tools other than zenity if
necessary, and changing one line is easier than finding all
invocations.  Calling the variable then ZENITY is dumb, but works.  It
also makes it easier to implement types other than warning in the
future.

> but his warnings using this syntax do not work on my system
> whereas the warnings using the original syntax do work for me.
> Can anyone explain?

That I'm afraid baffles me, and not having an 8.10 system around I
can't really troubleshoot.  Try walking through steps in an
interactive shell rather than running the script and see if you get
any useful output.

> 2) When zenity warnings are available on my system they are not in a
> window on top (they are minimized) and I have to have to click its tab in
> the window list to bring it to the top.
>
> How can I get them to pop up on top?  Is is something about my system?

Sorry, can't reproduce that behavior on Karmic either...  Checked for
any bugs filed against zenity or metacity for 8.10?

> To test on your Ubuntu system, paste the following 3 lines below a
> new file ~/.gnome2/nautilus-scripts/testscript  and save it.
>
> #!/bin/bash
>   zenity --warning \
>          --text="Some text to display in a little window"
>
> Make testscript executable (from nautilus: file> properties> Permissions>)
> The execute it from Nautilus ( file> scripts> )
> Does it display a window on top or do you have to bring it to the top?
>
>
> BTW I have a somewhat similar phenomenom with the image viewer, EOG, Eyes
> of Gnome. If I double click on an image file in Nautilus, EOG displayes it
> in a window on top.  But if I double click on another image while the
> first image window is on top or minimized, both the first image window
> and the new one are minimized.
>
> Fred

 - Tony Yarusso



More information about the ubuntu-us-mn mailing list