LinuxQuestions.org
Help answer threads with 0 replies.
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 07-12-2009, 02:56 AM   #1
yo8rxp
Member
 
Registered: Jul 2009
Location: Romania
Distribution: Ubuntu 10.04 Gnome 2
Posts: 68

Rep: Reputation: 13
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 netmonitor.sh:

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


fi
if [ $q -eq 2 ];then notify-send -i /home/gabriel/netmon/on.png 'Network cable pluged';let y=0;/home/gabriel/netmon/zenityon.sh
fi
sleep 1
done

zenityon.sh and zenityoff.sh are another scripts using zenity notification system that tell gnome-panel to display icons acording to cable state but the problems is that netmonitor.sh 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
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,546
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Hello yo8rxp

You could try backgrounding zenity[(on)|(off)].sh by putting a & after its path, for example.
Code:
/home/gabriel/netmon/zenityon.sh &
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.

Best

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

Original Poster
Rep: Reputation: 13
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 !
 
  


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 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


All times are GMT -5. The time now is 07:47 PM.

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