solved - Need right click menus for iconified apps

Hi all,

I’ve created a FvwmIconMan module which shows iconified apps like amarok or xmms (it’s a pseudo systray). Now I want a popup menu with some functions like play, next, previous or maximize when I click the icon with the right mouse button. How can I do that?

I have considerate to go over the tip name which appears if I move over the particular icon to choose the right menu, but I found nothing how I can get the name shown in the tip.

Can anybody help me?

Btw does exists a list of FVWM variables? If yes, where?

Thanks in advance.

Best regards,

TF

You just want something like this, I assume?

*FvwmIconMan: Action Mouse 3 N sendcommand "Popup MyMenu"

Or if you wanted it specific for a certain application, you’re going to have to use FvwmButtons, and qualify the window to produce a custom menu.

There’s a list in ‘man fvwm’ – I might put something on the wiki, in due course.

– Thomas Adam

Hi Thomas,

what do you mean with
“Or if you wanted it specific for a certain application, you’re going to have to use FvwmButtons, and qualify the window to produce a custom menu.” ?
The icons shown in the FvwmIconMan module are iconified running apps! Why should I create buttons for these apps? :confused:

Perhaps I verbalize it wrong. Please have a look at my screenshot ( http://www.lynucs.org/index.php?screen_id=213455111543bb1caf6731f&p=screen )
-> right below you see a field with one icon (kontact) under the tip and left above you see its thumbnail. So what I want is for this app a right click popup menu.

Your code with the action line is good (I have taken it for deiconify the app with the left mouse click) but how can I bind it to the specific icon? Is there a variable for the tip?

Hope you can help me again. :blush:

Best regards,

TF

You don’t, it’s just what I would have done, since it is much easier to direct individual entities in FvwmButtons. If you wanted to do it via FvwmIconMan, the only way I can think you could do it is to destroy and recreate the menu each time. So something like this…

*FvwmIconMan: Action Mouse 3 N sendcommand "Popup specialMenu"

… which tells FVWM we want a specific menu to popup. Now, this menu is going to have to be destroyed and recreated each time, to take into account the likely window it will be operating on. So that’s the first thing to add to this menu:

DestroyMenu specialMenu
AddToMenu specialMenu DynamicPopupAction CheckWindows specialMenu

… which just creates a new menu on the popup action. I could have used “DestroyMenu recreate foo”, but there’s no need here. Here, the DynamicPopupAction is calling a function “CheckWindows” which will be the function to create a menu based on what you select. We’re also passing a parameter into it – the menu that will house these options – “specialMenu” in this case. So, “CheckWindows”:

DestroyFunc CheckWindows
AddToFunc   CheckWindows
+ I DestroyMenu $0
+ I AddToMenu $0
+ I ThisWindow ("xmms") AddToMenu $0 "play" "Exec exec xmms -foo"
+ I ThisWindow ("gaim") AddToMenu $0 "gaim foo" "Exec exec gaim -foo"
+ I ThisWindow AddToMenu $0 "" Nop
+ I ThisWindow ("other") AddToMenu $0 "other foo" "Exec exec other --foo"
....

HTH,

– Thomas Adam

Hi Thomas,

it works perfectly with one iconified app. But if I have a second app in the FvwmIconMan module it shows every time the menu for the first app :frowning:

In the FvwmIconMan module is room for 14 icons/apps (2 lines for each 7 icons). At the moment I have defined three apps for showing in this module:

: *FvwmTaskbarIconMan: 1 ButtonGeometry 32x1 : *FvwmTaskbarIconMan: 1 ManagerGeometry 7x2 : *FvwmTaskbarIconMan: 1 Sort id *FvwmTaskbarIconMan: 1 Title "" : *FvwmTaskbarIconMan: 1 Show amaroK, kontact, xmms :

Is it correct that the first app name is displayed in $0, second in $1 and so on?

Best Regards,

TF

Odd. Here’s the following I used, pasted directly out of FvwmConsole (I use this a lot to answer questions) that works as it should:

AddToMenu specialMenu DynamicPopupAction CheckWindows specialMenu
DestroyFunc CheckWindows
AddToFunc   CheckWindows
+ I DestroyMenu recreate $0
+ I AddToMenu $0
+ I ThisWindow ("fooa") AddToMenu $0 "Xmessage" "Exec exec xmessage"
+ I ThisWindow ("foob") AddToMenu $0 "Xmessage2" "Exec exec xmessage"

I don’t understand what you’re asking with this sentence – sorry.

– Thomas Adam

Hi Thomas,

with+ I DestroyMenu recreate $0instead of+ I DestroyMenu $0 it works wonderful now :stuck_out_tongue:

Great thanks to you !!

To my question about $0 - I have thought, that here FVWM finds the name of the first app in the FvwmIconMan module …

For what stands $0 in this case? For the name of the app focused under the mouse pointer?

Best Regards,

TF

I neglected to include it originally – sorry. That was a translation error on my part.

No, $0 refers to the first parameter passed into the function. If you recall the menu definition, we had:

AddToMenu specialMenu DynamicPopupAction CheckWindows specialMenu

“CheckWindows” is the function, and “specialMenu” is a parameter, which FVWM knows as “$0”. If I were to pass more parameters into a function, then they would be “$1”, “$2”, etc, depending on how many I were passing to it.

HTH,

– Thomas Adam

Just for refrence the code

[code]AddToMenu specialMenu DynamicPopupAction CheckWindows specialMenu
DestroyFunc CheckWindows
AddToFunc CheckWindows

  • I DestroyMenu recreate $0
  • I AddToMenu $0
  • I ThisWindow (“fooa”) AddToMenu $0 “Xmessage” “Exec exec xmessage”
  • I ThisWindow (“foob”) AddToMenu $0 “Xmessage2” “Exec exec xmessage” [/code]
    is soing some more work than needed.

The same effect would be achived with

AddToMenu specialMenu DynamicPopupAction CheckWindows specialMenu
DestroyFunc CheckWindows
AddToFunc   CheckWindows
+ I DestroyMenu recreate $0
+ I AddToMenu $0
+ I ThisWindow ("fooa")  + "Xmessage" Exec exec xmessage
+ I ThisWindow ("fooa")  + "Xmessage2" Exec exec xmessage

or

AddToMenu specialMenu DynamicPopupAction CheckWindows specialMenu
DestroyFunc CheckWindows
AddToFunc   CheckWindows
+ I DestroyMenu recreate $0
+ I ThisWindow ("fooa")  AddToMenu $0 "Xmessage" Exec exec xmessage
+ I ThisWindow ("fooa")  AddToMenu $0 "Xmessage2" Exec exec xmessage