¿Can I detect tray icon position of a Wine app?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
vaites
Newbie
Newbie
Posts: 2
Joined: Mon Mar 08, 2010 4:39 am

¿Can I detect tray icon position of a Wine app?

Post by vaites »

Hi

Many Windows apps uses a tray icon. ¿There are a command or method to determine x and y corrds of that icon?. I want this to develop a notifier that shows a balloon "growing" from tray icon.

Thanks in adavance :)
hellork
Level 3
Level 3
Posts: 82
Joined: Thu Mar 27, 2008 7:13 pm

Post by hellork »

$ xwininfo -tree
1 child:
0x5a00005 (has no name): ("explorer.exe" "Wine") 20x24+0+0 +953+0
1 child:
0x5a00006 (has no name): () 20x24+0+0 +953+0

On my system, it shows the location of wine's tray icon area, known as "explorer.exe" at position 953,0 as well as an unnamed icon for taskmgr. (I was running taskmgr in the tray at the time.) That's the problem. A lot of these tray icons aren't going to have names.

The xwininfo source code should offer up enough information to write a program for linux.

:oops: You didn't specify if you wanted to program for linux or windows.

Windows stuff: Get to know the Windows API. Use FindWindow() if you know the name or title of the icon and pass the hwnd to GetWindowRect(). For all intents and purposes, the icons can be treated as desktop windows.

If you don't know the name of the icon or they don't have one, you can enumerate top-level windows with GetDesktopWindow(), EnumChildWindows(). Have fun!
vaites
Newbie
Newbie
Posts: 2
Joined: Mon Mar 08, 2010 4:39 am

Post by vaites »

wow, that's what i need!!! many thanks hellork

i was trying to detect the Spotify tray icon in Gnome. With this command i get the info I needed:

Code: Select all

xwininfo -id `wmctrl -l -p | grep "lateral superior" | awk '{print $1}'` -tree | grep "explorer.exe" | awk '{print $8}'
Just replace "lateral superior" with Gnome tray panel name (get with wmctrl -l -p) and done :)

I wrote some posts in my blog to explain my experience with Wine and Spotify, if someone wants to know: http://dmnet.bitacoras.com/?s=spotify+wine

Thanks !! :)
Locked