Discussion:
FVWM: function to toggle panel
James Griffin
2014-01-06 11:09:59 UTC
Permalink
Hi

I have a panel on the bottom of the display, i'd like a function i can
bind to a key press combination that will open it if it's not already
and close it if it is.

I've tried several ways, I can seem to get the dual function action
right. Does anyone have some tips as to how i can do this?
Dominik Vogt
2014-01-06 13:30:20 UTC
Permalink
Post by James Griffin
I have a panel on the bottom of the display, i'd like a function i
can bind to a key press combination that will open it if it's not
already and close it if it is.
I have this in my config:

#//
#// Application toggling function
#//
#// first argument is the window name, second argument is the command to start
#// the application.
AddToFunc ToggleWindow
+ I None ($$0, CirculateHit) $$1
+ I TestRc (Match) Break
+ I Next (currentpage, visible, !iconic, $$0, CirculateHit) Close
+ I TestRc (Match) Break
+ I Next ($$0, CirculateHit) Function MakeVisible

AddToFunc MakeVisible
+ I MoveToDesk
+ I MoveToPage
+ I MoveToScreen
+ I Raise
+ I Iconify off
+ I WindowShade off

AddToFunc ToggleFvwmConsole
+ I ToggleWindow FvwmConsole "Module FvwmConsole"

AddToFunc ToggleXMessages
+ I ToggleWindow XMessages "Function RunXMessages"

etc.

If that's not what you're looking for, please describe what you're
trying to do in more detail.
Post by James Griffin
I've tried several ways, I can seem to get the dual function action
right. Does anyone have some tips as to how i can do this?
Ciao

Dominik ^_^ ^_^
--
Dominik Vogt
James Griffin
2014-01-06 13:33:47 UTC
Permalink
Post by Dominik Vogt
Post by James Griffin
I have a panel on the bottom of the display, i'd like a function i
can bind to a key press combination that will open it if it's not
already and close it if it is.
#//
#// Application toggling function
#//
#// first argument is the window name, second argument is the command to start
#// the application.
AddToFunc ToggleWindow
+ I None ($$0, CirculateHit) $$1
+ I TestRc (Match) Break
+ I Next (currentpage, visible, !iconic, $$0, CirculateHit) Close
+ I TestRc (Match) Break
+ I Next ($$0, CirculateHit) Function MakeVisible
AddToFunc MakeVisible
+ I MoveToDesk
+ I MoveToPage
+ I MoveToScreen
+ I Raise
+ I Iconify off
+ I WindowShade off
AddToFunc ToggleFvwmConsole
+ I ToggleWindow FvwmConsole "Module FvwmConsole"
AddToFunc ToggleXMessages
+ I ToggleWindow XMessages "Function RunXMessages"
etc.
If that's not what you're looking for, please describe what you're
trying to do in more detail.
Post by James Griffin
I've tried several ways, I can seem to get the dual function action
right. Does anyone have some tips as to how i can do this?
Ciao
Dominik ^_^ ^_^
Hi Dominik, that is helpful. Although, what I need is to have a function
that will test to see if my fvwmbuttons panel is open; if it is not,
open it; if it is close it. This is then bound to a key stroke(s)
essentially allowing me to open and close the panel when I need using a
simple keyboard action.

Cheers, Jamie
Dominik Vogt
2014-01-06 15:22:30 UTC
Permalink
Post by James Griffin
Although, what I need is to have a
function that will test to see if my fvwmbuttons panel is open; if
it is not, open it; if it is close it.
I see. I have this in my config:

If you give the button that controls the panel an Id, you can
"click" it with a command:

*FvwmButtons(2x1+13+0, Padding 2, Panel(indicator 15) FvwmPagerPanel `Module FvwmPager FvwmPagerPanel 0 3`, Id panel_control_button)

You can then use the fvwm core command to press the button

SendToModule FvwmButtons PressButton panel_control_button 1

or as a key binding

key f1 a n SendToModule FvwmButtons PressButton panel_control_button 1

This works just as if you click on the panel button in
FvwmButtons with mouse button 1.

Actually it's not really necessary to give the button an id, you
can also use the button's coordinates (+13+0 in the example), but
that is less convenient because if the FvwmButtons layout changes,
you may have to recalculate the coordinates.

Ciao

Dominik ^_^ ^_^
--
Dominik Vogt
James Griffin
2014-01-08 14:26:45 UTC
Permalink
Post by Dominik Vogt
Post by James Griffin
Although, what I need is to have a
function that will test to see if my fvwmbuttons panel is open; if
it is not, open it; if it is close it.
If you give the button that controls the panel an Id, you can
*FvwmButtons(2x1+13+0, Padding 2, Panel(indicator 15) FvwmPagerPanel `Module FvwmPager FvwmPagerPanel 0 3`, Id panel_control_button)
You can then use the fvwm core command to press the button
SendToModule FvwmButtons PressButton panel_control_button 1
or as a key binding
key f1 a n SendToModule FvwmButtons PressButton panel_control_button 1
This works just as if you click on the panel button in
FvwmButtons with mouse button 1.
Actually it's not really necessary to give the button an id, you
can also use the button's coordinates (+13+0 in the example), but
that is less convenient because if the FvwmButtons layout changes,
you may have to recalculate the coordinates.
Ciao
Dominik ^_^ ^_^
Thanks Dominik, helpful info. I've come up with something that works ok.
Loading...