Results 1 to 9 of 9

Thread: Nautilus Scripts with Zenity

  1. #1
    Join Date
    Oct 2007
    Location
    Vancouver, Canada
    Beans
    77
    Distro
    Ubuntu 10.04 Lucid Lynx

    Question Nautilus Scripts with Zenity

    Hey guy,

    I'm just working on a quick script that backs up my /home to a specific location. Right now I have no idea how long the process takes unless I execute the command from the terminal. I was hoping somebody knew of a quick solution to showing a progress bar of the 'tar' command. I believe this would utilize Zenity, but I have no experience with that. If anyone could help me out that would be awesome. It's a very, very basic script (below).

    Code:
    #!/bin/sh
    
    cd /media/Storage/
    tar jcfv homeBackup.tar.bz2 ~

  2. #2
    Join Date
    Feb 2008
    Location
    Townsville, Qld Australia
    Beans
    1,065

    Re: Nautilus Scripts with Zenity

    This page has some info on how the zenity progress bar works http://www.rolfs.no/2007/10/14/small...-gnome-zenity/ but it doesn't look as though it is going to be easy to do. You could throw up a notification using gnome-osd-client or or libnotify-bin at the start and the end of the script.
    Code:
    #!/bin/sh
    notify-send "Backup started"
    cd /media/Storage/
    tar jcfv homeBackup.tar.bz2 ~
    notify-send "Backup completed"
    Registered Linux User #464572
    journal.ryanhaigh.net
    www.ryanhaigh.net

  3. #3
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Nautilus Scripts with Zenity

    Code:
    cd /media/Storage/
    tar jcfv homeBackup.tar.bz2 ~ 2>&1 | zenity --progress --title="Archiving..."
    See : http://www.linuxjournal.com/content/...riendly-zenity



    In scripts, use a full path if at all possible for commands and files.

    If you have a complex script, use variables to reduce errors (typos) and repetitive typing.

    TAR="/bin/tar"
    SOURCE="/media/Storage/"
    ARCHIVE="/home/user/homeBackup.tar.bz2"
    Last edited by bodhi.zazen; June 27th, 2008 at 04:49 AM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #4
    Join Date
    Oct 2007
    Location
    Vancouver, Canada
    Beans
    77
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Nautilus Scripts with Zenity

    Wow, those are both great solutions. I like the way the progress bar looks and it seems to work alright. Obviously tar'ing up my /home is taking a few minutes, but I think this is definitely what I was looking for. Thanks a lot for the help guys, I'll keep those links bookmarked for the future!

    Troy.

  5. #5
    Join Date
    Oct 2006
    Location
    Earth United States
    Beans
    Hidden!
    Distro
    Ubuntu 7.04 Feisty Fawn

    Re: Nautilus Scripts with Zenity

    on the topic of zenity, I would like to know how to use zenity to input variables into a script at sertin points. The point are any thang between the <> and it would be nice to have a message to tell me what to do. Here is the script

    !#/bin/bash
    # NOTE: Run as root
    ifconfig <interface> down
    dhclient -r <interface>
    ifconfig <interface> up
    iwconfig <interface> essid <"network-name">
    iwconfig <interface> mode Managed
    dhclient <interface>


    Thanx
    Craig.
    Last edited by NULL712; June 27th, 2008 at 08:00 AM.

  6. #6
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

  7. #7
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Nautilus Scripts with Zenity

    In addition, once you have looked at those links, to be honest ...

    man zenity

    The man page is quite complete.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  8. #8
    Join Date
    Apr 2008
    Beans
    18

    Cool Zenity. how do i show tooltip

    hi,
    i am very new to gui programming. but i was wondering is there a way to notify the user about some event passively.

    i tried
    Code:
    zenity --info --text="my script completed"
    but the problem is it steals the focus from my workspace.
    I was wondering how can i give the cool notifications that come from the tray and does not steal focus. a good example is the "safe to remove device" pop up balloon message..

    Can anyone help me how can i get that..


    or any pointers to example code would also be great

    thanks
    spice

  9. #9
    Join Date
    Feb 2007
    Beans
    4,045
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Zenity. how do i show tooltip

    It's called notification. Check the links I posted earlier and the man-page for examples. The notification part isn't thoroughly documented though. This shows you how to get a bit more control over it: http://blogs.gnome.org/jamesh/2004/0...ication-icons/

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •