Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Ubuntu This forum is for the discussion of Ubuntu Linux.


  Search this Thread
Old 07-12-2009, 02:56 AM   #1
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 102

Rep: Reputation: 30
gnome-panel icon refresh

being a newbie on linux got this problem :
need a notification about ethernet cable pluged /unpluged (i use laptop on the field and need to check good/deffective cables)
wrote this bash script

while [ 1 ]
x=$(cat /sys/class/net/eth0/carrier)
if [ $q -eq 0 ];then notify-send -i /home/gabriel/netmon/off.png 'Network cable unpluged';let y=1;/home/gabriel/netmon/

if [ $q -eq 2 ];then notify-send -i /home/gabriel/netmon/on.png 'Network cable pluged';let y=0;/home/gabriel/netmon/
sleep 1
done and are another scripts using zenity notification system that tell gnome-panel to display icons acording to cable state but the problems is that script waits for zenity , and zenity waits for user input therefore the loop is paused.
instructing zenity with --timeout other than 0 results in clearing icon from panel and i need it to stay there
I need to know how to tell gnome-panel to display and change e.g. systray icon or a launcher icon without kiilall gnome-panel for refresh
Old 07-12-2009, 06:11 AM   #2
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello yo8rxp

You could try backgrounding zenity[(on)|(off)].sh by putting a & after its path, for example.
/home/gabriel/netmon/ &
That way the calling script will continue running once it has called zenity[(on)|(off)].sh. Use ps (or whatever) to check whether zenity[(on)|(off)].sh terminates OK.


Old 07-12-2009, 07:10 AM   #3
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 102

Original Poster
Rep: Reputation: 30
works like a charm

guys from distrowatch web site are right saying " Put the fun back into computing"

thanks for the quick info ,it works great now.
There is a lot indeed to learn about programming ,hope to be on the right way.
cheers !


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 change a GNOME panel icon from command line? General Programming 0 03-19-2007 06:22 PM
gnome panel icon size zba78 Linux - Software 1 02-09-2007 12:24 AM
gnome-cups-icon in Panel Notification Area utanja Debian 0 01-29-2005 03:39 PM
ethernet status icon in panel in gnome dnkonzept Mandriva 2 12-20-2004 03:09 AM > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 07:19 AM.

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