Inactive button for inactive window

Hello,

I would like for inactive windows that title buttons are inactive.

My conf:

ButtonStyle 1 Active Pixmap arrow-activeup.png
ButtonStyle 2 Active Pixmap close-activeup.png
ButtonStyle 4 Active Pixmap maximize-activeup.png
ButtonStyle 6 Active Pixmap iconify-activeup.png

ButtonStyle 1 Inactive Pixmap empty.png
ButtonStyle 2 Inactive Pixmap empty.png
ButtonStyle 4 Inactive Pixmap empty.png
ButtonStyle 6 Inactive Pixmap empty.png

For inactive windows there are no visible buttons but however I can press the button.
I would like make it really inactive.

I hope it is clear ?

You can do this a few ways. What you’re after is use of the “!Button x” style. So…

DestroyModuleConfig FE-ButtonShuffle

*FE-ButtonShuffle: Cmd Function
*FE-ButtonShuffle: focus_change AddRemoveButton

DestroyFunc AddRemoveButton
AddToFunc   AddRemoveButton
+ I All (!Focused, CurrentPage) WindowStyle !Button 1, !Button 3
+ I Current WindowStyle Button 1, Button 3

Module FvwmEvent FE-ButtonShuffle

There’s other ways you could do this as well. The above approach is messy. since it will create a slight flicker, and the “All” command performs its operation on windows that have already had the window style applied. It does, of course, depend entirely upon the point at which you decide you want to implement this (i.e., if there were any existing windows open then you would have to use All).

HTH,

– Thomas Adam

Thanks, it works !!

But as you said, that create a flicker. I’m going to remove the title bar.

Dam

Don’t sound so surprised.

You could do that, or use the HasTitle patch I wrote for FVWM which would work inside conditional commands.

The better approach to this (which then would make this apply to only two windows at a time), is to set a default style such as this:

Style * !Buttons x, !Buttons y

Which assumes that all windows created won’t have which ever buttons you want to define. That’s OK, since unless you’re using something like ‘GrabFocus’ the windows won’t be receiving focus unless you ask for it, in which case:

DestroyModuleConfig FE-ShowHideButtons 
*FE-ShowHideButtons: Cmd Function
*FE-ShowHideButtons: focus_change ReStyleWindows

DestroyFunc ReStyleWindows
AddToFunc   ReStyleWindows
+ I Current WindowStyle Button x, Button y
+ I Prev (AcceptsFocus, !Focused) WindowsStyle !Button x, !Button y

So you see how this now reduces the need to hit other windows which we don’t need to? No flicker, too.

C’est tres mieux, n’est pas?

– Thomas Adam