On Fri, Sep 05, 2014 at 12:37:41PM +0300, Nikos Leonardos wrote:
> Dear all--
> 
> I'm trying to define a function (to be triggered by a
> window-menu) that (1) toggles the Title style and (2)
> maximizes the window vertically (restoring the total height
> of the window would be even better). Here is my attempt.
> 
>     DestroyFunc FuncToggleTitle
>     AddToFunc   FuncToggleTitle
>     + I PipeRead \
>     'if xprop -id $[w.id]|grep WM_FRAME|grep -q 19; \
>        then echo "WindowStyle !Title"; \
>        else echo "WindowStyle Title"; fi'
>     + I Maximize True 0 100 
> 
> The 19 is because I have borderwidth 3 and title-height 16. Is
> there a better way to determine if the window is titled or
> not?

There is no condition for HasTitle, although it looks like I had a patch for
this:

http://xteddy.org/fvwm/patches/hastitle_hasborders.patch

> My main problem however is that the "Maximize True 0 100"
> command does not work as I want. In particular, it feels like
> it uses the height before the "WindowStyle (!)Title" affects
> it. 

It will do, because those won't be applied necessarily in the order you
think they will.  What I would do is to use State instead to achieve this.

        DestroyFunc ToggleTitleMaximize
        AddToFunc   ToggleTitleMaximize
        + I ThisWindow (State 0) RestoreWindow
        + I TestRc (NoMatch) ThisWindow (!State 0) ApplyWindow

        DestroyFunc RestoreWindow
        AddToFunc   RestoreWindow
        + I DestroyWindowStyle
        + I Maximize

        DestroyFunc ApplyWindow
        AddToFunc   ApplyWindow
        + I WindowStyle State 0, !Title
        + I Maximize 0 100

So you can then bind "ToggleTitleMaximize" to something.

-- Thomas Adam

Reply via email to