Page 1 of 2

Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 20:30
by ray
The Salix Update notifier script puts an icon on the sys tray if it detects updates are available.
However, if i decide not to do my updates and wait, after a period of time, it adds another icon as well. This way, given enough time, we will end up with quite a few icons :)

Perhaps the script should be modified to remove the current icon before adding another?

Cheers,
ray

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 20:40
by damNageHack
ray wrote:Perhaps the script should be modified to remove the current icon before adding another?
Better add only a new one if there is not already one :)
But I wonder how this could be solved due to the usage of zenity ... :? Maybe with some kind of a lock file. You would have to check in both cases for a running zenity process (that shows the icon).

But ... why are you using the update notifier if you are not interested in updates? You can also increase the interval to check for updates.

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 20:48
by ray
damNageHack wrote:
ray wrote:Perhaps the script should be modified to remove the current icon before adding another?
Better add only a new one if there is not already one :)
But I wonder how this could be solved due to the usage of zenity ... :? Maybe with some kind of a lock file. You would have to check in both cases for a running zenity process (that shows the icon).

But ... why are you using the update notifier if you are not interested in updates? You can also increase the interval to check for updates.
I've been looking at trying to modify the script since i posted this, but i havent yet found a way to do so. I'm no expert at bash, so maybe someone else can find a way.

Well, my current scenario is pretty rare, but It's pretty normal scenario where you are Working on/Downloading something so you might want to postpone the update to later.

Cheers,
ray

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 20:53
by damNageHack
You can not solve that problem due to zenity (the icon process) runs as another process. Either you terminate that process after some time or inactivity (no reaction from user) or it runs forever if no other process (e.g. in thaour case the update-notificater scrpit) terminates or kills it.

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 20:59
by ray
One way i can think of is to move the zenity notification icon to a seperate script, so we can track the pid and kill it before showing another.

Will try and give it a whirl.

Cheers,
ray

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 21:57
by damNageHack
Maybe try something like the following. You should only have to change the line
zenity --notification \
to
pgrep -f zenity.+salix || zenity --notification \
ray wrote:One way i can think of is to move the zenity notification icon to a seperate script, so we can track the pid and kill it before showing another.
I think no good idea with a pid or lock file. If the process will be killed or crashes for some other reasons you will stick with that file and the user will never get a notification any more.

EDIT:
Although, I can not reproduce it here with Salix Live 13.1.1 LXDE. The icon shows up again only if I've clicked on it before, but there is never more than one icon. Maybe my work around helps anyways.

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 22:29
by ray
damNageHack wrote:Maybe try something like the following. You should only have to change the line
zenity --notification \
to
pgrep -f zenity.+salix && zenity --notification \
EDIT:
Although, I can not reproduce it here with Salix Live 13.1.1 LXDE. The icon shows up again only if I've clicked on it before, but there is never more than one icon. Maybe my work around helps anyways.
That way you will end up with multiple pid's if you have different zenity processes running.
And yes, i don't particularly like tracking apps through pid's to kill them either, but i cant think of any other way to do this.

I do have the latest version of salix-update-notifier and i wonder why i have the problem here.
But, looking at the script, i can see that what i'm facing is indeed possible.

Cheers,
ray

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 22:36
by damNageHack
Have you tried my suggestion with pgrep? You should modify the script /usr/bin/salix-update-notifier as described, only one line is affected.

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 22:43
by ray
@damNageHack,

The pgrep line you wrote wouldnt work if there's more than one instance of zenity around, would it?
Anyways, i'll have a shot at it tomorrow, it's getting a bit late.

Cheers,
ray

Re: Salix Update Notifier - Multiple Notification Icons

Posted: 18. Sep 2010, 23:05
by damNageHack
Sorry, but I doubt that I understand your problem.
man pgrep wrote: pgrep looks through the currently running processes and lists the pro-
cess IDs which matches the selection criteria to stdout. All the cri-
teria have to match. For example,
[...]
-f The pattern is normally only matched against the process name.
When -f is set, the full command line is used.
ray wrote:The pgrep line you wrote wouldnt work if there's more than one instance of zenity around, would it?
Do you see the pattern "zenity.+salix" in my code? And now, think again. I doubt that there will be more than one process with a command line that matches a pattern with "salix" in it, and you can see from the original script that the call to zenity uses a special "salix" icon file, so the pattern should be unique enough.