Way to control panels (SOLVED)

I’m using panel and I wanted to know if there are some commands I can use for a key binding or in a function to shade / unshade a panel.

Thx for reply

Assuming you mean a panel for FvwmButtons, then you can do something like this:

Key F A CM Next (name_of_panel, CirculateHit) SomeFunction

That sets up a keybinding, which you can change at your leisure.

Then you’ll need a way of simulating a means of pressing the panel button. Something lik ethis should suffice:

DestroyFunc SomeFunction
AddToFunc SomeFunction
+ I WarpToWindow 50 50
+ I FakeClick d 1 p 1 w 250 r 1

The only disadvantage is that the pointer is warped in order to simulate the click – you can of course mitigate this by adding another WarpToWindow command to the end of the function or a focus command, etc., to move it away as soon as it’s finished.

Note that also, FakeClick is not guaranteed to work.

– Thomas Adam

Thx a lot ! works like a charm :slight_smile: (except when I try to launch the function at init)

Yes, it would do. You would have to Schedule it.

– Thomas Adam

Thx again for the step by step instructions :wink:
I didn’t try scheduling this command for now, I’ve just added + I Wait "program swallowed in this panel" before I Next ("panel_name", CirculateHit) SomeFunction

Depends what you’re wanting it to do. I personally use Wait as little as I can in StartFunction since it can (depending on what ever you’ve asked it to load) pause for an annoying length of time.

But then it’s your choice. Ideally this should be added as an option to FvwmButtons at some point, although there are potenital issues in setting the geometry of the would-be swallowed panel button to ensure it opens up in the correct place.

– Thomas Adam

In fact I wanted my pager and my taskbar (which are each a panel) to show when I start fvwm. The wait method is not clean, I agree, sometimes when I restart fvwm the FakeClick don’t work

Here is the code I’ve made :

[code]DestroyFunc PanelOpen
AddToFunc PanelOpen

  • I SetEnv mouseX $[pointer.x]
  • I SetEnv mouseY $[pointer.y]
  • I WarpToWindow 50 50
  • I FakeClick d 1 p 1 w 250 r 1
  • I WindowId root 1 WarpToWindow $[mouseX]p $[mouseY]p[/code]
  • I UnSetEnv mouseX
  • I UnSetEnv mouseY

It saves the position of the pointer before using FakeClick to restore them at the end
You can “invoke” it this way :

 Next ("Name_of_panel", CirculateHit) PanelOpen

If you must use SetEnv, at least use UnSetEnv at the end of the function.

– Thomas Adam

thx, edited