Re: FVWM: set style by state

2012-11-07 Thread Chris Bannister
On Wed, Nov 07, 2012 at 11:21:48AM +0100, Bastian wrote:
 On 07Nov12 09:19 +, Thomas Adam wrote:
  What do you think this line does?
 
 I expected the line to select a set of windows, on which the following
 functions operate. Now I see that this is not working this way.

This one:
 + I All (FvwmConsole)

or

This one:
 + I All (State $0)


Please keep sufficient context, so that the post actually makes sense on
its own.

-- 
If you're not careful, the newspapers will have you hating the people
who are being oppressed, and loving the people who are doing the 
oppressing. --- Malcolm X



Re: FVWM: set style by state

2012-11-07 Thread Jaimos F Skriletz

On 11/07/2012 02:07 AM, Bastian wrote:

DestroyFunc F1
AddToFunc F1
+ I All (FvwmConsole)
+ I Move w+10 w+0
+ I Move w+0 w+10
Most likely you only have a single window named FvwmConsole, so this All 
command only gets a single window and the once it has the context of 
that single window it knows which one to move. Try running this function 
if you have two FvwmConsole windows open. See what happens.




DestroyFunc PullTaggedWindows
AddToFunc PullTaggedWindows
+ I All (State $0)
+ I Move w+10 w+0
+ I Move w+0 w+10


What happens here is you are most likely matching multiple windows. You 
aren't telling fvwm to move each window but only to move one window (in 
which you used the conditional to get the correct window context). Since 
fvwm cannot determine which one window you wanted to move to is asking 
you which one to move.


Hence + I All (State $0) CustomMoveFunction

where the CustomMoveFunction does your move. That command will run that 
function on each and every window it matches (instead of just trying to 
get the window context for the rest of the function).


jaimos



Re: FVWM: set style by state

2012-11-07 Thread Bastian
 DestroyFunc F1
 AddToFunc F1
 + I All (FvwmConsole)
 + I Move w+10 w+0
 + I Move w+0 w+10
 Most likely you only have a single window named FvwmConsole, so this
 All command only gets a single window and the once it has the
 context of that single window it knows which one to move. Try
 running this function if you have two FvwmConsole windows open. See
 what happens.

If I run the Function F1 directly out of the FvwmConsole, then I have to
select a window
If I add 

  Key F12 A A Function F1

and run the Function F1 by a key binding, then always the window with
the current focus is affected, even it is not an FvwmConsole and in
spite of that FvwmCOnsole windows exists or not.


 DestroyFunc PullTaggedWindows
 AddToFunc PullTaggedWindows
 + I All (State $0)
 + I Move w+10 w+0
 + I Move w+0 w+10
 
 What happens here is you are most likely matching multiple windows.

Same as above.

 You aren't telling fvwm to move each window but only to move one
 window (in which you used the conditional to get the correct window
 context). Since fvwm cannot determine which one window you wanted to
 move to is asking you which one to move.
 
 Hence + I All (State $0) CustomMoveFunction
 
 where the CustomMoveFunction does your move. That command will run
 that function on each and every window it matches (instead of just
 trying to get the window context for the rest of the function).

This is working perfectly. Thank you :)



Re: FVWM: set style by state

2012-11-06 Thread Thomas Adam
On 7 November 2012 07:35, Bastian bastian-fvwm-org-20121...@t6l.de wrote:
 On 05Nov12 10:24 -0700, Jaimos F Skriletz wrote:
 I am under the impression that Pick is slightly different in once
 you pick the window the context is known so you only have to pick
 the window once and then run multiple things on that window. That

 Yes, Pick is different and it works to pick once and then operate on the
 resulting window with multiple commands like stated in the man page.

 The conditional command 'All' e.g. does not work in this way.

Sure it does -- again, there's a difference between a window and
function context.  Confer:

All (XTerm) SomeFunction

DestroyFunc SomeFunction
AddToFunc   SomeFunction
+ I Echo $[w.id]
+ I Echo $[w.name]



The *function* supplies the window context.

-- Thomas Adam



Re: FVWM: set style by state

2012-11-05 Thread Jaimos F Skriletz

On 11/05/2012 07:57 AM, Bastian wrote:

State is for conditional expressions.
We need more information about what you are trying to do.

More in detail:

Mouse 2 W 4 Function TagWindow 10
Mouse 2 R 4 Function PullTaggedWindows 10

DestroyFunc TagWindow
AddToFunc TagWindow
+ I Pick State $0 1


When you tag your window you can do other things to it. One useful tool 
is WindowStyle. It will change the Style of the window in question. So 
just like your TagWindow function picks a window to set to State 10, you 
can use that to set the WindowStyle to change the border color (or do 
other options) on that window.


So you could do something like this

AddToFunc TagWindow
+ I Pick
+ I TestRc (Error) Break
+ I State $0 1
+ I WindowStyle BorderColorSet foo, HilightBorderColorset bar

You can of course add other options/actions to that window you picked 
(note the second line is just to stop the function if a window wasn't 
sucessfuly picked). You might also prefer to use + I Pick (conditions) 
and put some sane conditions so you don't accidently pick a window you 
don't want to (like transient windows, pannels, etc)


If you have a way to toggle the state of the window (so you can turn off 
State 10 in your case, you will have to do something similar and reverse 
the colorset change on the border color)


jaimos



Re: FVWM: set style by state

2012-11-05 Thread Bastian
On 05Nov12 08:40 -0700, Jaimos F Skriletz wrote:
 So you could do something like this
 
 AddToFunc TagWindow
 + I Pick
 + I TestRc (Error) Break
 + I State $0 1
 + I WindowStyle BorderColorSet foo, HilightBorderColorset bar
 
 If you have a way to toggle the state of the window (so you can turn
 off State 10 in your case, you will have to do something similar and
 reverse the colorset change on the border color)

Thank you for this comprehensive instructions.
Using WindowStyle does the job. 

Off topic: Using conditional commands (Pick, All ,...) without a command
in the same line does not work for me.



Re: FVWM: set style by state

2012-11-05 Thread Jaimos F Skriletz

On 11/05/2012 09:04 AM, Bastian wrote:

On 05Nov12 08:40 -0700, Jaimos F Skriletz wrote:

So you could do something like this

AddToFunc TagWindow
+ I Pick
+ I TestRc (Error) Break
+ I State $0 1
+ I WindowStyle BorderColorSet foo, HilightBorderColorset bar

If you have a way to toggle the state of the window (so you can turn
off State 10 in your case, you will have to do something similar and
reverse the colorset change on the border color)

Thank you for this comprehensive instructions.
Using WindowStyle does the job.

Off topic: Using conditional commands (Pick, All ,...) without a command
in the same line does not work for me.



In general that is correct, you need All (conditions) Action, Next 
(conditions) Action, etc


The idea is things like Raise, Move, WindowStyle need to know what 
window you want to do it for and the conditionals find the right window. 
ThisWindow is a useful one to use once you already have the window 
chosen/context is known.


I am under the impression that Pick is slightly different in once you 
pick the window the context is known so you only have to pick the window 
once and then run multiple things on that window. That example I gave 
you comes directally from the man page for FVWM 2.6.5 so if it doesn't 
work (I haven't had time to test it) it is a bug with the man page. In 
that case you may want to do something like this instead


AddToFunc ToggleWindow
+ I Pick (Conditions) CustomStateFunction

AddToFunc CustomStateFunction
+ I State ...
+ I WindowStyle ...
+ I Move ...

and so forth. The reason why you want to do that is you don't want the 
function to pause and have you pick the window for each action in your 
function.


The other option is to use the ThisWindow conditional, so + I ThisWindow 
(conditions) Action. I will admit I'm a bit unsure as to the proper 
method, but that should be enough to play with to get it to work as 
expected.


jaimos