View Full Version : Water Effect Notifications
luciferin
June 24th, 2007, 05:37 PM
Not really an application but I didn't know where else to post this. I've been digging around looking for a working method to get the Pidgin tray icon to give a water effect for notification. It's really simple but nobody has compiled a complete howto. You just need two scripts to do it. I take no credit for the code, I'm just compiling it here. Maybe someone could work this into a plug in somehow?
First make and open a file
/usr/local/bin/waterping.sh
#!/bin/bash
#./waterping.sh 0 0
#If you want to ping the coordinates x0, y0
dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/water/allscreens/point org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$1 string:'y' int32:$2
Next make and open a file:
/usr/local/bin/senicon.sh
#!/bin/bash
#requires waterping.sh
WINFO=`xwininfo -root -tree | egrep ' (1[2-9]|2[0-4])x(1[2-9]|2[0-4])\+0\+0' | grep "$1" | cut -d ')' -f 2-`
WIW=`echo $WINFO | cut -d 'x' -f 1`
WIH=`echo $WINFO | cut -d 'x' -f 2 | cut -d '+' -f 1`
WIX=`echo $WINFO | cut -d '+' -f 4`
WIY=`echo $WINFO | cut -d '+' -f 5`
let WAX=WIX+WIW/2
let WAY=WIY+WIH/2
waterping.sh $WAX $WAY 2>/dev/null
Then in Pidgin go into the Preferences manager. Under the Sounds tab set the Method to Command and type in senicon.sh pidgin
If you get access errors try doing the following:
sudo chmod a+x /usr/local/bin/waterping.sh
sudo chmod a+x /usr/local/bin/senicon.sh
*Thanks goes to Chema on the Spanish forums for translating the original code for Compiz Fusion
You can see the video with the original instructions here:
http://www.youtube.com/watch?v=IcOZMGuieDU
searayman
June 24th, 2007, 05:55 PM
cool, wish i coudl try this but my graphics card doesnt support the water effects.... hopefully will be gettign a new laptop soon
Laughing Man
July 9th, 2007, 03:55 AM
Followed the guide but it doesn't seem to work for me. Nothing happens when I get a message in Pidgin (well I tried by IMing myself).
Necromancer
July 16th, 2007, 01:00 AM
I've modified the code a little to make it MUCH faster, and now it should be working with all type of icons (hopefully)
If your panel is located on top or left or right - specify its location in LAYOUT variable
#!/bin/bash
#Panel layout - Top || Bottom || Left || Right
LAYOUT="Bottom"
if [ "x$1" == "x" ]; then
echo "Please specify the icon name, f. ex. 'pidgin' as parameter 1";
exit 0
fi
WINFO=`xwininfo -root -tree -name "$LAYOUT Expanded Edge Panel"| grep "$1" | cut -d ')' -f 2-`
WIW=`echo $WINFO | cut -d 'x' -f 1`
WIH=`echo $WINFO | cut -d 'x' -f 2 | cut -d '+' -f 1`
WIX=`echo $WINFO | cut -d '+' -f 4`
WIY=`echo $WINFO | cut -d '+' -f 5`
let WAX=WIX+WIW/2
let WAY=WIY+WIH/2
dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/water/allscreens/point org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$WAX string:'y' int32:$WAY
Necromancer
July 16th, 2007, 08:15 PM
[quote="Laughing Man":87340]Followed the guide but it doesn't seem to work for me. Nothing happens when I get a message in Pidgin (well I tried by IMing myself).[/quote:87340]
Try the code i've posted in previous post - should work. Works in gnome environment only.
shame
July 16th, 2007, 10:07 PM
I'm using this in kde for kmail new mail notifications, nice. Need to look at what other apps I can use it with now.
unabatedshagie
July 19th, 2007, 12:50 AM
I've modified the code a little to make it MUCH faster, and now it should be working with all type of icons (hopefully)
If your panel is located on top or left or right - specify its location in LAYOUT variable
[code:179e7]
#!/bin/bash
#Panel layout - Top || Bottom || Left || Right
LAYOUT="Bottom"
if [ "x$1" == "x" ]; then
echo "Please specify the icon name, f. ex. 'pidgin' as parameter 1";
exit 0
fi
WINFO=`xwininfo -root -tree -name "$LAYOUT Expanded Edge Panel"| grep "$1" | cut -d ')' -f 2-`
WIW=`echo $WINFO | cut -d 'x' -f 1`
WIH=`echo $WINFO | cut -d 'x' -f 2 | cut -d '+' -f 1`
WIX=`echo $WINFO | cut -d '+' -f 4`
WIY=`echo $WINFO | cut -d '+' -f 5`
let WAX=WIX+WIW/2
let WAY=WIY+WIH/2
dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/water/allscreens/point org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$WAX string:'y' int32:$WAY
[/code:179e7]Would I be right in assuming that I only need to use this one piece of code instead of the two in the first post?
Necromancer
July 19th, 2007, 07:57 PM
Would I be right in assuming that I only need to use this one piece of code instead of the two in the first post?
Correct.
unabatedshagie
July 21st, 2007, 11:41 AM
I'm having a small issue with the new script, I have my notification area at the bottom right of the screen but the ripples appear at the top left of the screen.
Necromancer
July 21st, 2007, 04:32 PM
I'm having a small issue with the new script, I have my notification area at the bottom right of the screen but the ripples appear at the top left of the screen.
That's because it cannot find either coordinates or the icon itself. What desktop environment do you use?
Run xwininfo and point on the icon you want to water effect. post here the results, i'll try to help.
unabatedshagie
July 21st, 2007, 09:18 PM
I'm using gnome on a default install of ubuntu.
It's probably due to the fact that I'm running dual screens.
Anyway the results of the command are: [code:10b72]xwininfo: Window id: 0x100002f "Bottom Edge Panel"
Absolute upper-left X: 1400
Absolute upper-left Y: 1025
Relative upper-left X: 1400
Relative upper-left Y: 1025
Width: 280
Height: 25
Depth: 24
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +1400+1025 -1680+1025 -1680-0 +1400-0
-geometry 280x25+1400-0[/code:10b72]
Necromancer
July 21st, 2007, 09:54 PM
I'm using gnome on a default install of ubuntu.
It's probably due to the fact that I'm running dual screens.
Try to replace
[code:1ce16]WINFO=`xwininfo -root -tree -name "$LAYOUT Expanded Edge Panel"| grep "$1" | cut -d ')' -f 2-`[/code:1ce16]
line with
[code:1ce16]WINFO=`xwininfo -root -tree -name "$LAYOUT Edge Panel"| grep "$1" | cut -d ')' -f 2-`[/code:1ce16]
unabatedshagie
July 21st, 2007, 11:02 PM
Thanks works a treat :D
Laughing Man
July 27th, 2007, 10:24 PM
[quote="Laughing Man":552a0]Followed the guide but it doesn't seem to work for me. Nothing happens when I get a message in Pidgin (well I tried by IMing myself).
Try the code i've posted in previous post - should work. Works in gnome environment only.[/quote:552a0]
Yep it works now. Looks cool too, but to bad I can't have sound with it lol.
Necromancer
July 29th, 2007, 10:46 PM
[quote="Laughing Man":d0249]
Yep it works now. Looks cool too, but to bad I can't have sound with it lol.[/quote:d0249]
Why can't? I use
[code:d0249]
if [ "x$2" != "x" ]; then
aplay $2
fi
[/code:d0249]
Just give the sound file name as parameter 2
kazamx
August 1st, 2007, 05:24 PM
Is it possible this could be rolled into the water plugin? It seems that its something alot of people would love to have (even the nubs like me who don't know what to do with that script you posted)
unabatedshagie
August 1st, 2007, 05:56 PM
I'm having intermittent problems with the code, sometimes the ripples appear in the correct position other times they appear at the top left-hand corner of the screen.
wallcrawler78
August 28th, 2007, 05:39 PM
I have an interesting sittuation...
When i run the command : "/usr/local/bin/waterping.sh pidgin" from a terminal it works just fine. The pidgin icon in the top corner gives off a ripple effect.
When i copy that command into pidgin, it creates a ripple in the left corner of the screen. I dont understand why it doesnt want to work correctly...
I am using this code...
[code:aa557]
#!/bin/bash
#Panel layout - Top || Bottom || Left || Right
LAYOUT="Top"
if [ "x$1" == "x" ]; then
echo "Please specify the icon name, f. ex. 'pidgin' as parameter 1";
exit 0
fi
WINFO=`xwininfo -root -tree -name "$LAYOUT Expanded Edge Panel"| grep "$1" | cut -d ')' -f 2-`
WIW=`echo $WINFO | cut -d 'x' -f 1`
WIH=`echo $WINFO | cut -d 'x' -f 2 | cut -d '+' -f 1`
WIX=`echo $WINFO | cut -d '+' -f 4`
WIY=`echo $WINFO | cut -d '+' -f 5`
let WAX=WIX+WIW/2
let WAY=WIY+WIH/2
dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/water/allscreens/point org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$WAX string:'y' int32:$WAY
[/code:aa557]
Any help would be much appreciated!
Dan
Necromancer
August 29th, 2007, 02:42 AM
That's because it cannot find either coordinates or the icon itself. What desktop environment do you use?
Run xwininfo and point on the icon you want to water effect. post here the results, i'll try to help.
unabatedshagie
September 14th, 2007, 06:20 AM
I have just re-installed my system to try gutsy and this doesn't seem to be working any more.
Can anyone think of any reason why?
l.capriotti
September 14th, 2007, 08:46 AM
any luck to have a working script for KDE? xwininfo output on the trayicon bar is the following:
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x1a00123 "kicker"
Absolute upper-left X: 768
Absolute upper-left Y: 994
Relative upper-left X: 768
Relative upper-left Y: 994
Width: 512
Height: 30
Depth: 24
Visual Class: TrueColor
Border width: 0
Class: InputOutput
Colormap: 0x20 (installed)
Bit Gravity State: NorthWestGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +768+994 -0+994 -0-0 +768-0
-geometry 512x30-0-0
while executing xwininfo -root -tree -name "kicker" gives:
xwininfo: Window id: 0x1a000bf "kicker"
Root window id: 0x5c (the root window) (has no name)
Parent window id: 0x5c (the root window) (has no name)
1 child:
0x1a000c0 (has no name): () 30x204+0+0 +1280+820
1 child:
0x1a000c1 (has no name): () 30x204+0+0 +1280+820
1 child:
0x1a000c2 (has no name): () 30x204+0+0 +1280+820
4 children:
0x1a000c6 (has no name): () 16x16+14+188 +1294+1008
0x1a000c5 (has no name): () 30x204+0+0 +1280+820
8 children:
0x1a060b6 (has no name): () 30x18+0+126 +1280+946
0x1a05496 (has no name): () 30x18+0+108 +1280+928
0x1a01102 (has no name): () 30x18+0+90 +1280+910
0x1a00961 (has no name): () 30x18+0+72 +1280+892
0x1a0074f (has no name): () 30x18+0+54 +1280+874
0x1a003ac (has no name): () 30x18+0+36 +1280+856
0x1a0035c (has no name): () 30x18+0+18 +1280+838
0x1a00263 (has no name): () 30x18+0+0 +1280+820
0x1a000c4 (has no name): () 100x30+0+0 +1280+820
0x1a000c3 (has no name): () 100x30+0+0 +1280+820
It seems there is no way to have info out if it, but please advice.
Cheers
Luigi
Necromancer
September 15th, 2007, 06:48 PM
l.capriotti, try replacing the line
WINFO=`xwininfo -root -tree -name "$LAYOUT Expanded Edge Panel"| grep "$1" | cut -d ')' -f 2-`
with
WINFO=`xwininfo -root -tree -name "kicker"| grep "$1" | cut -d ')' -f 2-`
l.capriotti
September 18th, 2007, 02:16 PM
@Necromancer:
from my output above you can see that
xwininfo -root -tree -name "kicker"
gives no names, hence no grep to identify the right icon...
Cheers
Luigi
Necromancer
September 18th, 2007, 02:29 PM
oic, probably need to find another way to find those icona names. Too bad i don't have kde.
ScottKidder
October 3rd, 2007, 06:08 PM
scott@scott-desktop:/usr/local/bin$ sudo senicon.sh pidgin
/usr/local/bin/senicon.sh: 11: let: not found
/usr/local/bin/senicon.sh: 12: let: not found
what's causing this?
Sememmon
October 6th, 2007, 07:54 PM
scott@scott-desktop:/usr/local/bin$ sudo senicon.sh pidgin
/usr/local/bin/senicon.sh: 11: let: not found
/usr/local/bin/senicon.sh: 12: let: not found
what's causing this?
Are you running just the single updated script now? And you don't need to sudo it.
Sememmon
October 6th, 2007, 07:59 PM
Is there a way to make it continuously ripple (once ever couple seconds) until the message window gains focus?
Necromancer
October 7th, 2007, 03:02 PM
Is there a way to make it continuously ripple (once ever couple seconds) until the message window gains focus?
I don't think so. it's better be done in application source.
Lunks
October 9th, 2007, 01:16 AM
I have a FX 5200 and this is really slow. Is it normal?
PurpZeY
October 9th, 2007, 07:40 AM
Necromancer, nice work. Script works perfectly.
I am new to scripting compiz, but when I look at this last line of code it is clear to me that d-sub is calling for water and then there are several options.
awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$WAX string:'y' int32:$WAY
Presumably some of these options control how the effect is going to come out...Can you describe or point me in the direction of where I might find out what specifically each variable/option controls?
Thanks for the script,
PurpZeY
some-guy
October 11th, 2007, 03:57 AM
I have a FX 5200 and this is really slow. Is it normal?
I used to have a FX 5200, the water effect was slow for me too:(
PurpZeY
October 11th, 2007, 06:58 AM
Is there a way to make it continuously ripple (once ever couple seconds) until the message window gains focus?
I was wondering this same thing myself and set out on a quest.
Someone from #python was able to assist me (read: walk me through) a script that tests if a window is in focus or not and return an exit value based on that.
I then wrote a simple bash while loop and added the code that was provided in the script by Necromancer with the adjustment of telling his script that the application in question was pidgin.
You'll want to tell pidgin to call "./loopscript1" If you want the ripples to come more or less slowly there is a sleep variable, just increase the number.
Lastly, I understand that this whole script could be done in python, but my knowledge of python is rather limited so, if anyone wants to merge them, I would certainly be happy.
Script 1 -- Loopscript
#!/bin/bash
while ! ./Test.py
do LAYOUT="Top"
#if [ "x$1" == "x" ]; then
#echo "Please specify the icon name, f. ex. 'pidgin' as parameter 1";
#exit 0
#fi
WINFO=`xwininfo -root -tree -name "$LAYOUT Panel"| grep "pidgin" | cut -d ')' -f 2-`
WIW=`echo $WINFO | cut -d 'x' -f 1`
WIH=`echo $WINFO | cut -d 'x' -f 2 | cut -d '+' -f 1`
WIX=`echo $WINFO | cut -d '+' -f 4`
WIY=`echo $WINFO | cut -d '+' -f 5`
let WAX=WIX+WIW/2
let WAY=WIY+WIH/2
dbus-send --type=method_call --dest=org.freedesktop.compiz /org/freedesktop/compiz/water/allscreens/point org.freedesktop.compiz.activate string:'root' int32:`xwininfo -root | grep id: | awk '{ print $4 }'` string:'amplitude' double:1 string:'x' int32:$WAX string:'y' int32:$WAY
sleep 6s
done
Script 2 -- Python "Focus Tester"
#!/usr/bin/python
import wnck
import gobject
DESIRED_WINDOW = "Buddy List"
def window_changed(screen):
win = screen.get_active_window()
if win is not None and win.get_name() == DESIRED_WINDOW:
exit(0)
else:
exit(1)
if __name__ == '__main__':
default_screen = wnck.screen_get_default()
default_screen.connect('active-window-changed', window_changed)
gobject.MainLoop().run()
Enjoy,
--Purp
ScottKidder
October 16th, 2007, 04:07 AM
I gave up on this for a while, but now I'm in Gutsy, and I'm running it as the single script, here's the output.
Failed to open connection to session message bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
PurpZeY
October 17th, 2007, 08:08 AM
I gave up on this for a while, but now I'm in Gutsy, and I'm running it as the single script, here's the output.
Failed to open connection to session message bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
As I did not write the dbus section of this script I can't say for sure. I have to imagine that because compiz-fusion is now built into gutsy that the command needs to be pointed elsewhere.
Since compiz-fusion is for all intensive purposes the same, you just need to find out where to point the command.
MrDuck
October 20th, 2007, 03:00 PM
Having this error while running that :/ (new to bash, what's "let" for?)
$ sh /usr/local/bin/senicon.sh kopete
/usr/local/bin/senicon.sh: 8: let: not found
/usr/local/bin/senicon.sh: 9: let: not found
Any suggestions?
Necromancer
October 20th, 2007, 08:51 PM
Having this error while running that :/ (new to bash, what's "let" for?)
$ sh /usr/local/bin/senicon.sh kopete
/usr/local/bin/senicon.sh: 8: let: not found
/usr/local/bin/senicon.sh: 9: let: not found
Any suggestions?
You should start it with bash, not sh.
Deimos
October 21st, 2007, 03:25 PM
This script is great, thanks a lot for posting it here.
However, i've run into a problem and i was unsuccessful to find a workaround yet: I'm using Polish version of ubuntu, and the gnome top panel name is translated into Polish as well - the problem it that it uses unicode characters. xprop name output looks like this:
WM_NAME(COMPOUND_TEXT) = "Dolny rozwijany panel kraw\304\231dziowy"
xwininfo refuses to accept this as a valid window name:
"xwininfo: error: No window with name Dolny rozwijany panel kraw\304\231dziowy exists!"
I tried substituting the '\304\231' for an actual character - still no success.
The only working workaround was to pass window ID instead of window name to xwininfo in the script, however panel's id changed after a reboot, and of course the script stopped working.
I've been thinking of creating a script using xprop that would set an environment variable with the panel id at startup, but I've been unsuccessful so far, since xprop requires using mouse to point the panel.
Any ideas on how to solve this problem?
Laughing Man
October 28th, 2007, 03:23 AM
[quote="Laughing Man":d0249]
Yep it works now. Looks cool too, but to bad I can't have sound with it lol.[/quote:d0249]
Why can't? I use
[code:d0249]
if [ "x$2" != "x" ]; then
aplay $2
fi
[/code:d0249]
Just give the sound file name as parameter 2
But I mean all Pidgin sounds. Login, Logout message, etc..
Necromancer
October 28th, 2007, 02:05 PM
[QUOTE=Necromancer;20995]
But I mean all Pidgin sounds. Login, Logout message, etc..
I mean it too ;). You should use external command in pidgin for sound and specify the name of the wav file as 2nd parameter to the script.
HMartinho
October 28th, 2007, 02:57 PM
Being such a noob sometimes is helpfull (talking about myself offcourse), why don't you make pidgin or whatever program act like any system alert? (by the way, how to do that?) I've noticed that ripple effect ocurs when for example i try to scroll up a windows that can't be more scrolled up, instead of plying the system sound it does a ripple, how do I put that in amsn sound setting for example? Or in Pidgin for all that matters.
Just an idea.
Cheers
Deciare
October 28th, 2007, 05:04 PM
Being such a noob sometimes is helpfull (talking about myself offcourse), why don't you make pidgin or whatever program act like any system alert? (by the way, how to do that?) I've noticed that ripple effect ocurs when for example i try to scroll up a windows that can't be more scrolled up, instead of plying the system sound it does a ripple, how do I put that in amsn sound setting for example? Or in Pidgin for all that matters.
Just an idea.
Cheers
I haven't done in-depth research into how a PC speaker beep is produced by most programs, but I think it's reasonable to expect that every system bell event eventually filters down to a single, easily detectable mechanism.
That's quite different from detecting notifications from a program that generates different sounds for different events. There is only one kind of system bell; to play any other sound, audio players, libraries, sound servers, sound architectures, and their various abstraction interfaces have to get involved. It may be extremely difficult to hook into every conceivable way a sound might be played. There are also programs that support multiple types of notifications, such as any program that uses KDE's notification system: sounds, message boxes, log messages, taskbar flashes, stderr, and program execution. Detecting all the different ways in which a program may respond to notify events is even trickier.
Having Compiz respond to every possible notification event won't be feasible until there's more standardisation in the way programs tell other programs that a notify event has taken place.
HMartinho
October 28th, 2007, 05:19 PM
But how could I make it so it produced a system bell alert, waht would I put in amsn sound selection for notification that would in fact reproduce the system bell?
I've tried with pcspkr $sound, with no success.
Thanks in advance.
Cheers
adamk
November 6th, 2007, 11:00 AM
Has anyone gotten this to work with xfce4?
Adam
jermo
November 7th, 2007, 06:50 PM
if I run it in terminal it works perfectly,
jeremy@jeremy-laptop:/usr/local/bin$ bash senicon.sh pidgin
if i type
senicon.sh pidgin
into pidgin.. nothing happens
edit: nevermind, I just put a bash in front of it and now it works perfectly.. I really don't know what I'm doing I got linux for the first time yesterday!
b0b
November 29th, 2007, 11:06 PM
works here i just try
copy bash senicon.sh pidgin to sound command in pidgin
http://www.youtube.com/watch?v=jvBFJHwZ3M0
b0b
December 11th, 2007, 09:48 AM
i just try to put in cgmail and works same as in pidgin ...just put in cgmail command
bash senicon.sh cgmail
gwrtheyrn
December 21st, 2007, 06:40 PM
nice script! works with skype too!
but kopete isn't able to run a script when an event occurs, or am i wrong?
Deciare
December 21st, 2007, 08:38 PM
You can configure notifications for Kopete, but the options aren't Kopete's own user interface. They're in kcontrol->Sound & Multimedia->System Notifications.
From the Event source dropdown list, select Kopete Messenger. Then click the Advanced >> button near the bottom-left corner of the window. Select the event for which you want to run the script, enable the Execute a program option, then enter a suitable command line for the script.
gwrtheyrn
December 22nd, 2007, 12:52 PM
nice! now the problem is this is pretty slow until it reacts... is there a way to speed it up? so it doesn't have a delay until it starts?
Sirus20x6
July 31st, 2008, 10:20 PM
Any ideas for kde 4.1? I'm not even sure what the new kicker is called.
Or should i give the python script a try?
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.